package com.sls.game.service.impl;

import java.util.List;
import java.util.UUID;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.google.gson.Gson;
import com.sls.core.common.CommonUtil;
import com.sls.core.socket.Head;
import com.sls.core.socket.ServerDisponseException;
import com.sls.core.socket.StartMain;
import com.sls.core.util.DataConversion;
import com.sls.core.util.ObjectIncreaseId;
import com.sls.core.util.ServerDateAndTime;
import com.sls.game.base.module.BaseDeal;
import com.sls.game.constant.ExceptionCodeDes;
import com.sls.game.dao.EBaiMiDAO;
import com.sls.game.dao.EnLinkProductDAO;
import com.sls.game.dao.GoodsInfoManageDAO;
import com.sls.game.dao.GoodsSupplyManageDAO;
import com.sls.game.dao.NutsNetGoodsInfoDAO;
import com.sls.game.dao.OhFeiGoodsBrandDAO;
import com.sls.game.dao.OhFeiGoodsInfoDAO;
import com.sls.game.dao.ProductBrandDAO;
import com.sls.game.dao.SevenNineNineSixDAO;
import com.sls.game.dao.TencentGoodsInfoDAO;
import com.sls.game.dao.enfu.EnfuGoodsDAO;
import com.sls.game.dao.enfu.EnfuGoodsDetailDAO;
import com.sls.game.dao.jpay.JpayGoodsDAO;
import com.sls.game.dao.maxshu.MaxshuDAO;
import com.sls.game.dao.wogreat.WogreatDAO;
import com.sls.game.dao.xingxitian.XingDisCountDAO;
import com.sls.game.dao.xingxitian.XingParvalueDAO;
import com.sls.game.dao.xinhe.XinHeProductDAO;
import com.sls.game.dao.yun.YunDAO;
import com.sls.game.page.Pagination;
import com.sls.game.pojo.GoodsManageInfo;
import com.sls.game.pojo.GoodsSupplyManageInfo;
import com.sls.game.pojo.NutsNetGoodsInfo;
import com.sls.game.pojo.OhFeiGoodsBrandInfo;
import com.sls.game.pojo.OhFeiGoodsInfo;
import com.sls.game.pojo.ProductBrandInfo;
import com.sls.game.pojo.TencentGoodsInfo;
import com.sls.game.pojo.ebaimi.EbaimiProduct;
import com.sls.game.pojo.enfu.EnfuGoodsDetailInfo;
import com.sls.game.pojo.enfu.EnfuGoodsInfo;
import com.sls.game.pojo.enlink.EnLinkProduct;
import com.sls.game.pojo.jieyitong.JieyitongGoodsInfo;
import com.sls.game.pojo.maxshu.MaxshuProduct;
import com.sls.game.pojo.snns.SevenNineNineSixProduct;
import com.sls.game.pojo.wogreat.WogreatProduct;
import com.sls.game.pojo.xingqitian.XingDisCountInfo;
import com.sls.game.pojo.xingqitian.XingParvalueInfo;
import com.sls.game.pojo.xinhe.XinHeProduct;
import com.sls.game.pojo.yunen.YunEnProduct;
import com.sls.game.service.OriginalGoodsService;

/**
 * 
 * @description 供应商商品审核
 * @author Wangxuegang
 * @date 2012-9-17
 * 
 */
@Service("originalGoodsService")
public class OriginalGoodsServiceImpl implements OriginalGoodsService {

	private static Logger log = Logger
			.getLogger(OriginalGoodsServiceImpl.class);

	private Gson gson = null;

	public OriginalGoodsServiceImpl() {
		gson = CommonUtil.gson();
	}

	@Resource(name = "nutsNetGoodsInfoDAO")
	private NutsNetGoodsInfoDAO nutsNetGoodsInfoDAO;
	@Resource(name = "ohFeiGoodsInfoDAO")
	private OhFeiGoodsInfoDAO ohFeiGoodsInfoDAO;
	@Resource(name = "tencentGoodsInfoDAO")
	private TencentGoodsInfoDAO tencentGoodsInfoDAO;
	@Resource(name = "goodsSupplyManageDAO")
	private GoodsSupplyManageDAO goodsSupplyManageDAO;
	@Resource(name = "productBrandDAO")
	private ProductBrandDAO productBrandDAO;
	@Resource(name = "ohFeiGoodsBrandDAO")
	private OhFeiGoodsBrandDAO ohFeiGoodsBrandDAO;
	@Resource(name = "goodsInfoManageDAO")
	private GoodsInfoManageDAO goodsInfoManageDAO;
	@Resource(name = "enLinkProductDAO")
	private EnLinkProductDAO enLinkProductDAO;
	@Resource(name = "xingParvalueDAO")
	private XingParvalueDAO xingParvalueDAO;
	@Resource(name = "xingDisCountDAO")
	private XingDisCountDAO xingDisCountDAO;
	@Resource(name = "jpayGoodsDAO")
	private JpayGoodsDAO jpayGoodsDAO;
	@Resource(name = "eBaiMiDAO")
	private EBaiMiDAO eBaiMiDAO;
	@Resource(name = "wogreatDAO")
	private WogreatDAO wogreatDAO;
	@Resource(name = "sevenNineNineSixDAO")
	private SevenNineNineSixDAO sevenNineNineSixDAO;
	@Resource(name = "yunDAO")
	private YunDAO yunDAO;
	@Resource(name = "enfuGoodsDAO")
	private EnfuGoodsDAO enfuGoodsDAO;
	@Resource(name = "enfuGoodsDetailDAO")
	private EnfuGoodsDetailDAO enfuGoodsDetailDAO;
	@Resource(name = "xinHeProductDAO")
	private XinHeProductDAO xinHeProductDAO;
	@Resource(name = "maxshuDAO")
	private MaxshuDAO maxshuDAO;
	
	/**
	 * 腾讯产品表分页查询
	 * 
	 * @param pageInruire
	 * @return
	 * @throws ServerDisponseException
	 */
	public String queryByPageTencentGoods(String body, Head head)
			throws ServerDisponseException {
		if (log.isInfoEnabled()) {
			log.info("进入Service开始处理[" + head.getRequestId() + "]的请求");
		}
		// 对消息body进行解析
		TencentGoodsInfo tencentGoodsInfo = gson.fromJson(body,
				TencentGoodsInfo.class);
		// 当前页
		String pageIndex = tencentGoodsInfo.getCurrentPage() + "";
		// 每页显示记录数
		String pageSize = tencentGoodsInfo.getPageSize() + "";
		boolean flag = checkDataAOfqueryPageInquire(pageIndex, pageSize,
				head.getRequestId());
		if (flag) { // 数据校验通过
			try {
				Pagination<TencentGoodsInfo> paginationList = null;
				paginationList = tencentGoodsInfoDAO
						.queryPaginationList(tencentGoodsInfo);

				String resultBody = null;
				if (paginationList != null) {
					resultBody = gson.toJson(paginationList);
				}
				log.info("分页查询结果为：  " + resultBody);
				if (log.isInfoEnabled()) {
					log.info("Service处理[" + head.getRequestId() + "]的请求已结束");
				}
				return resultBody;

			} catch (Exception e) {
				log.error("Service处理[" + head.getRequestId() + "]的请求出现异常！");
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		}

		return null;
	}

	/**
	 * 殴飞产品表分页查询
	 * 
	 * @param pageInruire
	 * @return
	 * @throws ServerDisponseException
	 */
	public String queryByPageOhFeiGoods(String body, Head head)
			throws ServerDisponseException {
		if (log.isInfoEnabled()) {
			log.info("进入Service开始处理[" + head.getRequestId() + "]的请求");
		}
		// 对消息body进行解析
		OhFeiGoodsInfo ohFeiGoodsInfo = gson.fromJson(body,
				OhFeiGoodsInfo.class);
		// 当前页
		String pageIndex = ohFeiGoodsInfo.getCurrentPage() + "";
		// 每页显示记录数
		String pageSize = ohFeiGoodsInfo.getPageSize() + "";
		boolean flag = checkDataAOfqueryPageInquire(pageIndex, pageSize,
				head.getRequestId());
		if (flag) { // 数据校验通过
			try {
				Pagination<OhFeiGoodsInfo> paginationList = null;
				paginationList = ohFeiGoodsInfoDAO
						.queryPaginationList(ohFeiGoodsInfo);

				String resultBody = null;
				if (paginationList != null) {
					resultBody = gson.toJson(paginationList);
				}
				log.info("分页查询结果为：  " + resultBody);
				if (log.isInfoEnabled()) {
					log.info("Service处理[" + head.getRequestId() + "]的请求已结束");
				}

				return resultBody;

			} catch (Exception e) {
				log.error("Service处理[" + head.getRequestId() + "]的请求出现异常！");
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		}

		return null;
	}

	/**
	 * 坚果网络产品表分页查询
	 * 
	 * @param pageInruire
	 * @return
	 * @throws ServerDisponseException
	 */
	public String queryByPageNutsNetGoods(String body, Head head)
			throws ServerDisponseException {
		if (log.isInfoEnabled()) {
			log.info("进入Service开始处理[" + head.getRequestId() + "]的请求");
		}
		// 对消息body进行解析
		NutsNetGoodsInfo nutsNetGoodsInfo = gson.fromJson(body,
				NutsNetGoodsInfo.class);
		// 当前页
		String pageIndex = nutsNetGoodsInfo.getCurrentPage() + "";
		// 每页显示记录数
		String pageSize = nutsNetGoodsInfo.getPageSize() + "";
		boolean flag = checkDataAOfqueryPageInquire(pageIndex, pageSize,
				head.getRequestId());
		if (flag) { // 数据校验通过
			try {
				Pagination<NutsNetGoodsInfo> paginationList = null;
				paginationList = nutsNetGoodsInfoDAO
						.queryPaginationList(nutsNetGoodsInfo);

				String resultBody = null;
				if (paginationList != null) {
					resultBody = gson.toJson(paginationList);
				}
				log.info("分页查询结果为：  " + resultBody);
				if (log.isInfoEnabled()) {
					log.info("Service处理[" + head.getRequestId() + "]的请求已结束");
				}

				return resultBody;

			} catch (Exception e) {
				log.error("Service处理[" + head.getRequestId() + "]的请求出现异常！");
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		}

		return null;
	}

	/**
	 * 数据校验
	 * 
	 * @param pageIndex
	 *            当前页
	 * @param pageSize
	 *            每页显示记录数
	 * @param reqId
	 */
	private boolean checkDataAOfqueryPageInquire(String pageIndex,
			String pageSize, String reqId) throws ServerDisponseException {
		boolean flag = false;

		if ("".equals(pageIndex) || pageIndex == null) {
			throw new ServerDisponseException(
					ExceptionCodeDes.CURRENT_PAGE_NULL.getCode(),
					ExceptionCodeDes.CURRENT_PAGE_NULL.getDescription());
		} else if ("".equals(pageSize) || pageSize == null) {
			throw new ServerDisponseException(
					ExceptionCodeDes.PAGE_SIZE_NULL.getCode(),
					ExceptionCodeDes.PAGE_SIZE_NULL.getDescription());
		} else {
			flag = true;
		}

		return flag;
	}

	/**
	 * 坚果网络产品审核
	 * 
	 * @param body
	 * @param head
	 * @return 模糊查询得到符合条件的品牌表结果集
	 * @throws ServerDisponseException
	 * @date 2012-09-24
	 */
	@Override
	public String saveAuditNutsNetGoods(String body, Head head)
			throws ServerDisponseException {
		if (log.isInfoEnabled()) {
			log.info("进入Service开始处理[" + head.getRequestId() + "]的请求");
		}

		// 对消息body进行解析
		final NutsNetGoodsInfo nutsNetGoodsInfo = gson.fromJson(body,
				NutsNetGoodsInfo.class);
		final Head head2 = head;
		new Thread(new Runnable() {

			@Override
			public void run() {
				boolean flag = checkDataOfNutsNetGoods(nutsNetGoodsInfo,
						head2.getRequestId());
				if (flag) { // 数据校验通过
					try {
						// 产品品牌
						String brandName = null;
						// 商品名称
						String goodsName = null;
						// 价格利率
						int priceRatio = nutsNetGoodsInfo.getPriceRatio();

						NutsNetGoodsInfo info = new NutsNetGoodsInfo();
						info.setIsAudit("0");
						List<NutsNetGoodsInfo> nuNeGoList = null;
						nuNeGoList = nutsNetGoodsInfoDAO
								.queryAllGoodsInfo(info);
						for (NutsNetGoodsInfo nutsNetGoodsInfo1 : nuNeGoList) {
							if (nutsNetGoodsInfo1 != null) {
								// 商品名称
								String name = nutsNetGoodsInfo1.getName();
								String[] str = new String[3];
								if (name != null) {
									str = name.split("-");
								}

								brandName = str[1];
								goodsName = str[1] + str[2];
							} else {
								log.error("Service处理[" + head2.getRequestId()
										+ "]的请求出现异常，商品记录数据库不存在！");
								throw new ServerDisponseException(
										ExceptionCodeDes.DATABASE_RECORDS_NOT_EXITS
												.getCode(),
										ExceptionCodeDes.DATABASE_RECORDS_NOT_EXITS
												.getDescription());
							}

							String supplyId = nutsNetGoodsInfo.getSuppliersId();
							String operator = nutsNetGoodsInfo.getOperator();
							String originalGoodsId = nutsNetGoodsInfo1
									.getSupProductId();
							// 手拉手品牌处理
							String brandId = processSlsBrand(brandName,
									supplyId, originalGoodsId, operator);
							// 手拉手商品信息处理
							String goodsId = processSlsGoodsInfo(brandId,
									head2, supplyId, originalGoodsId, operator,
									goodsName, priceRatio);
							// 手拉手商品供应处理
							processSlsGoodsSupply(goodsId, supplyId,
									originalGoodsId, operator);

							NutsNetGoodsInfo nuts = new NutsNetGoodsInfo();
							nuts.setSupProductId(originalGoodsId);
							nuts.setIsAudit("1");
							nutsNetGoodsInfoDAO.updateState(nuts);
						}

					} catch (Exception e) {
						log.error(e);
						throw new ServerDisponseException(
								ExceptionCodeDes.ACCESS_DATABASE_ERROR
										.getCode(),
								ExceptionCodeDes.ACCESS_DATABASE_ERROR
										.getDescription());
					}
				}

			}

		}).start();

		return null;
	}

	/**
	 * 手拉手商品供应处理
	 * 
	 * @param goodsId
	 * @param supplyId
	 * @param originalGoodsId
	 * @param operator
	 */
	private void processSlsGoodsSupply(String goodsId, String supplyId,
			String originalGoodsId, String operator) {
		GoodsSupplyManageInfo goodsSupplyManageInfo = null;
		GoodsSupplyManageInfo info = new GoodsSupplyManageInfo();
		info.setSuppliersId(supplyId);
		info.setOriginalGoodsId(originalGoodsId);
		info.setGoodsId(goodsId);
		/**
		 * 插入之前，先判断即将插入的商品记录是否存在
		 */
		goodsSupplyManageInfo = goodsSupplyManageDAO
				.queryByGoodsIdAndSupplyId(info);
		if (goodsSupplyManageInfo == null) {
			GoodsSupplyManageInfo info1 = new GoodsSupplyManageInfo();
			info1.setId(UUID.randomUUID().toString());
			info1.setGoodsId(goodsId);
			info1.setOriginalGoodsId(originalGoodsId);
			info1.setOperator(operator);
			// ...
			// 根据商品编号，查询商品信息表
			GoodsManageInfo goodsManageInfo = null;
			goodsManageInfo = goodsInfoManageDAO
					.queryGoodsInfoByGoodsId(goodsId);
			if (goodsManageInfo != null) {
				info1.setGoodsCategoryId(goodsManageInfo.getGoodsCategoryId());
				info1.setGoodsName(goodsManageInfo.getGoodsName());
				info1.setGoodsDescription(goodsManageInfo.getGoodsDescription());
				info1.setOfficialUrl(goodsManageInfo.getOfficialUrl());
				info1.setRechargeMode(goodsManageInfo.getRechargeMode());
				info1.setEnable(goodsManageInfo.getEnable());
				info1.setRechargeArea(goodsManageInfo.getRechargeArea());
				info1.setBrandName(goodsManageInfo.getBrandName());
				info1.setGoodsState("1");
			} else {
				throw new ServerDisponseException(
						ExceptionCodeDes.GOODS_NOT_EXIST.getCode(),
						goodsId
								+ ", "
								+ ExceptionCodeDes.GOODS_NOT_EXIST
										.getDescription());
			}
			// 插入时间
			String now = ServerDateAndTime.getNowDateTimeOfFormat();
			info1.setInsertTime(now);
			if ("20121000".equals(supplyId)) { // 殴飞
				addOhFeiGoods(info, info1);
			} else if ("20121001".equals(supplyId)) { // 坚果网络
				addNutsNetGoods(info, info1);
			} else if ("20121002".equals(supplyId)) { // 腾讯
				addTencentGoods(info, info1);
			} else if ("20121003".equals(supplyId)) { // 恩连
				addEnLinkGoods(info, info1);
			} else if ("20121004".equals(supplyId)) { // 星启天
				addXQTGoods(info, info1);
			} else if ("20121005".equals(supplyId)) { // 捷易通
				addJpayGoods(info, info1);
			} else if ("20121006".equals(supplyId)) { // 易百米
				addEBaiMiGoods(info, info1);
			} else if ("20121007".equals(supplyId)) { // 7996
				addSnnsGoods(info, info1);
			} else if ("20121008".equals(supplyId)) { // 沃谷
				addWogreatGoods(info, info1);
			} else if ("20121009".equals(supplyId)) { // 云恩
				addYunGoods(info, info1);
			} else if ("20121010".equals(supplyId)) { // 恩付
				addEnfuGoods(info, info1);
			} else if ("20121011".equals(supplyId)) { // 鑫合
				addXinHeGoods(info, info1);
			} else {
				// TODO
				String dealname = EKHInterfaceserviceImp.getDealName(supplyId);
				if (dealname == null || "".equals(dealname)) {
					log.info("进入Service开始处理建立供应关联关系的请求,无此供应商配置:" + supplyId);
					return;
				}
				try {
					BaseDeal basedeal = (BaseDeal) StartMain.APPLICATION_CONTEXT
							.getBean(dealname);
					basedeal.addGoodsSupplyRelation(info, info1);
				} catch (Exception e) {
					log.error("进入Service开始处理建立供应关联关系的请求,供应商信息 查询异常:" + supplyId
							+ "|" , e);
				}
			}

		} else {
			// 原始供应商商品的价格
			String originalPrice = null;
			String originalParvalue = null;
			XingParvalueInfo xqtproduct = null;
			if ("20121000".equals(supplyId)) { // ============== 殴飞
				OhFeiGoodsInfo ohFeiGoodsInfo = ohFeiGoodsInfoDAO
						.queryById(originalGoodsId);
				if (ohFeiGoodsInfo != null) {
					originalPrice = ohFeiGoodsInfo.getGoodsInPrice();
					originalParvalue = ohFeiGoodsInfo.getParValue();
				}
			} else if ("20121001".equals(supplyId)) { // 坚果网络
				NutsNetGoodsInfo nutsNetGoodsInfo = queryNutsnetOriGoods(originalGoodsId);
				if (nutsNetGoodsInfo != null) {
					originalPrice = nutsNetGoodsInfo.getUnitPrice();
					originalParvalue = nutsNetGoodsInfo.getParvalue();
				}
			} else if ("20121002".equals(supplyId)) { // 腾讯
				TencentGoodsInfo tencentInfo = tencentGoodsInfoDAO
						.queryGoodsInfoGoodsId(originalGoodsId);
				if (tencentInfo != null) {
					originalPrice = tencentInfo.getInPrice();
				}
			} else if ("20121003".equals(supplyId)) { // 恩连
				EnLinkProduct enlink = this.enLinkProductDAO
						.queryByProductId(originalGoodsId);
				if (enlink != null) {
					originalPrice = enlink.getProductInPrice();
					originalParvalue = enlink.getProductParvalue();
				}
			} else if ("20121004".equals(supplyId)) { // 星启天
				xqtproduct = this.xingParvalueDAO
						.queryParvalueInfoByGoodsId(originalGoodsId);
				if (xqtproduct != null) {
					originalParvalue = xqtproduct.getParvalueId();
				}
			} else if ("20121005".equals(supplyId)) { // 捷易通
				JieyitongGoodsInfo jInfo = this.jpayGoodsDAO
						.queryByGoodsId(originalGoodsId);
				if (jInfo != null) {
					originalPrice = jInfo.getInPrice();
					originalParvalue = jInfo.getParValue();
				}
			} else if ("20121006".equals(supplyId)) { // 易百米
				EbaimiProduct eInfo = this.eBaiMiDAO
						.queryByGoodsId(originalGoodsId);
				if (eInfo != null) {
					originalPrice = eInfo.getSup_price();
					originalParvalue = eInfo.getPrice();
				}
			} else if ("20121007".equals(supplyId)) { // 7996
				SevenNineNineSixProduct snns = this.sevenNineNineSixDAO
						.queryByProductId(originalGoodsId);
				if (snns != null) {
					originalPrice = snns.getProductPrice();
					originalParvalue = snns.getProductParvalue();
				}
			} else if ("20121008".equals(supplyId)) { // 沃谷
				WogreatProduct wp = this.wogreatDAO
						.queryByProId(originalGoodsId);
				if (wp != null) {
					originalPrice = wp.getProductPrice();
					originalParvalue = wp.getProductParvalue();
				}
			} else if ("20121009".equals(supplyId)) { // 云恩
				YunEnProduct yun = this.yunDAO
						.queryByProductId(originalGoodsId);
				if (yun != null) {
					originalPrice = yun.getProductPrice();
					originalParvalue = yun.getProductParvalue();
				}
			} else if ("20121010".equals(supplyId)) { // 恩付
				String definedproductid = originalGoodsId;
				EnfuGoodsDetailInfo enfuDet = enfuGoodsDetailDAO
						.queryGoodsDetail(definedproductid);
				String productid = null;
				if (enfuDet != null) {
					productid = enfuDet.getProductid();
				}
				EnfuGoodsInfo enInfo = enfuGoodsDAO
						.queryEnfuGoodsInfoByProductid(productid);
				if (enInfo != null) {
					originalPrice = enInfo.getBuyprice();
					originalParvalue = enInfo.getParvalue();
				}
			} else if ("20121011".equals(supplyId)) { // 鑫合
				XinHeProduct xin = this.xinHeProductDAO
						.queryByProductId(originalGoodsId);
				if (xin != null) {
					originalPrice = xin.getProductPrice();
					originalParvalue = xin.getProductParvalue();
				}
			} else {
				// TODO
				String dealname = EKHInterfaceserviceImp.getDealName(supplyId);
				if (StringUtils.isNotEmpty(dealname)) {
					GoodsSupplyManageInfo querysupply = null;
					try {
						BaseDeal basedeal = (BaseDeal) StartMain.APPLICATION_CONTEXT
								.getBean(dealname);
						querysupply = basedeal
								.querySupplyprice(originalGoodsId);
					} catch (Exception e) {
						log.error("进入Service开始处理获取进货价查询请求,上游商品信息 查询异常:"
								+ originalGoodsId + "|" , e);
					}
					GoodsSupplyManageInfo gSupply = new GoodsSupplyManageInfo();
					String id = goodsSupplyManageInfo.getId();
					gSupply.setId(id);
					gSupply.setOperator(operator);
					if (querysupply == null) {
						gSupply.setGoodsCostPrice(DataConversion
								.toInt(originalPrice));
						gSupply.setGoodsValue(DataConversion
								.toInt(originalParvalue));
					} else {
						gSupply.setGoodsCostPrice(querysupply
								.getGoodsCostPrice());
						gSupply.setGoodsValue(querysupply.getGoodsValue());
					}
					gSupply.setModifyTime(ServerDateAndTime
							.getNowDateTimeOfFormat());
					this.goodsSupplyManageDAO.update(gSupply);
					return;
				}
			}

			String id = goodsSupplyManageInfo.getId();
			GoodsSupplyManageInfo gSupply = new GoodsSupplyManageInfo();
			gSupply.setId(id);
			gSupply.setOperator(operator);
			if ("20121004".equals(supplyId)) { // 星启天
				if (xqtproduct != null) {
					List<XingDisCountInfo> disInfoList = this.xingDisCountDAO
							.queryDiscountByProductId(xqtproduct.getProductid());
					if (disInfoList != null && disInfoList.size() > 0) {
						XingDisCountInfo disInfo = disInfoList.get(0);
						if (disInfo != null) {
							String discount = disInfo.getRecordSalePrice();
							int costPrice = DataConversion.cal(
									originalParvalue, discount);
							gSupply.setGoodsCostPrice(costPrice);
						}
					}
				}
			} else {
				gSupply.setGoodsCostPrice(DataConversion.toInt(originalPrice));
			}
			gSupply.setGoodsValue(DataConversion.toInt(originalParvalue));
			gSupply.setModifyTime(ServerDateAndTime.getNowDateTimeOfFormat());
			this.goodsSupplyManageDAO.update(gSupply);
		}
	}

	/**
	 * 手拉手商品供应处理（星启天专用）
	 * 
	 * @param goodsId
	 * @param supplyId
	 * @param originalGoodsId
	 * @param operator
	 */
	@SuppressWarnings("unused")
	private void processSlsGoodsSupplyforXingQiTian(String goodsId,
			String supplyId, String originalGoodsId, String operator) {
		GoodsSupplyManageInfo goodsSupplyManageInfo = null;
		GoodsSupplyManageInfo info = new GoodsSupplyManageInfo();
		info.setSuppliersId(supplyId);
		info.setGoodsId(goodsId);
		info.setOriginalGoodsId(originalGoodsId);

		/**
		 * 插入之前，先判断即将插入的商品记录是否存在
		 */
		goodsSupplyManageInfo = goodsSupplyManageDAO.queryGoodsSupplyInfo(info);
		if (goodsSupplyManageInfo == null) {
			GoodsSupplyManageInfo info1 = new GoodsSupplyManageInfo();
			info1.setId(UUID.randomUUID().toString());
			info1.setGoodsId(goodsId);
			info1.setOriginalGoodsId(originalGoodsId);
			info1.setOperator(operator);
			// 根据商品编号，查询商品信息表
			GoodsManageInfo goodsManageInfo = null;
			goodsManageInfo = goodsInfoManageDAO
					.queryGoodsInfoByGoodsId(goodsId);
			if (goodsManageInfo != null) {
				info1.setGoodsCategoryId(goodsManageInfo.getGoodsCategoryId());
				info1.setGoodsName(goodsManageInfo.getGoodsName());
				info1.setGoodsDescription(goodsManageInfo.getGoodsDescription());
				info1.setOfficialUrl(goodsManageInfo.getOfficialUrl());
				info1.setRechargeMode(goodsManageInfo.getRechargeMode());
				info1.setEnable(goodsManageInfo.getEnable());
				info1.setRechargeArea(goodsManageInfo.getRechargeArea());
				info1.setBrandName(goodsManageInfo.getBrandName());
				info1.setGoodsState("1");
			} else {
				throw new ServerDisponseException(
						ExceptionCodeDes.GOODS_NOT_EXIST.getCode(),
						goodsId
								+ ", "
								+ ExceptionCodeDes.GOODS_NOT_EXIST
										.getDescription());
			}
			// 插入时间
			String now = ServerDateAndTime.getNowDateTimeOfFormat();
			info1.setInsertTime(now);
			addXQTGoods(info, info1);
		} else {
			// 原始供应商商品的价格
			String originalPrice = null;
			String originalParvalue = null;
			XingParvalueInfo xqtproduct = null;
			xqtproduct = this.xingParvalueDAO
					.queryParvalueInfoByGoodsId(originalGoodsId);
			if (xqtproduct != null) {
				originalParvalue = xqtproduct.getParvalueId();
			}
			String id = goodsSupplyManageInfo.getId();
			GoodsSupplyManageInfo gSupply = new GoodsSupplyManageInfo();
			gSupply.setId(id);
			if ("20121004".equals(supplyId)) { // 星启天
				if (xqtproduct != null) {
					List<XingDisCountInfo> disInfoList = this.xingDisCountDAO
							.queryDiscountByProductId(xqtproduct.getProductid());
					if (disInfoList != null && disInfoList.size() > 0) {
						XingDisCountInfo disInfo = disInfoList.get(0);
						if (disInfo != null) {
							String discount = disInfo.getRecordSalePrice();
							int costPrice = DataConversion.cal(
									originalParvalue, discount);
							gSupply.setGoodsCostPrice(costPrice);
						}
					} else {
						XingParvalueInfo parva = this.xingParvalueDAO
								.queryParvalueInfoByGoodsId(originalGoodsId);
						if (parva != null) {
							String discount = parva.getSaleprice();
							int commSalePrice = DataConversion.cal(
									originalParvalue, discount);
							gSupply.setGoodsCostPrice(commSalePrice);
						}
					}
				}
			} else {
				gSupply.setGoodsCostPrice(DataConversion.toInt(originalPrice));
			}
			gSupply.setGoodsValue(DataConversion.toInt(originalParvalue));
			gSupply.setModifyTime(ServerDateAndTime.getNowDateTimeOfFormat());
			this.goodsSupplyManageDAO.update(gSupply);
		}
	}

	private void addXQTGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) {
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();
		info1.setSuppliersId(supplyId);
		info1.setSupplyName("星启天");
		XingParvalueInfo xqtproduct = this.xingParvalueDAO
				.queryParvalueInfoByGoodsId(originalGoodsId);
		if (xqtproduct != null) {
			// 商品面值
			String parValue = xqtproduct.getParvalueId();
			int goodsValue = DataConversion.toInt(parValue);

			// 进价计算
			List<XingDisCountInfo> disInfoList = this.xingDisCountDAO
					.queryDiscountByProductId(xqtproduct.getProductid());
			if (disInfoList != null && disInfoList.size() > 0) {
				XingDisCountInfo disInfo = disInfoList.get(0);
				if (disInfo != null) {
					String discount = disInfo.getRecordSalePrice();
					int goodsCostPrice = DataConversion.cal(parValue, discount);
					info1.setGoodsCostPrice(goodsCostPrice);
				}
			} else {
				XingParvalueInfo parva = this.xingParvalueDAO
						.queryParvalueInfoByGoodsId(originalGoodsId);
				if (parva != null) {
					String discount = parva.getSaleprice();
					int commSalePrice = DataConversion.cal(parValue, discount);
					info1.setGoodsCostPrice(commSalePrice);
				}
			}

			info1.setGoodsValue(goodsValue);
			info1.setRemark("星启天商品供应新增");
			try {
				goodsSupplyManageDAO.insert(info1);
			} catch (Exception e) {
				log.error(e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

	}

	private void addEnLinkGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) {
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();
		info1.setSuppliersId(supplyId);
		info1.setSupplyName("恩联");
		EnLinkProduct enLinkProduct = null;
		enLinkProduct = this.enLinkProductDAO.queryByProductId(originalGoodsId);
		if (enLinkProduct != null) {
			// 进价
			String unitPrice = enLinkProduct.getProductInPrice();
			int goodsCostPrice = DataConversion.toInt(unitPrice);
			info1.setGoodsCostPrice(goodsCostPrice);
			// 商品面值
			String parValue = enLinkProduct.getProductParvalue();
			int goodsValue = DataConversion.toInt(parValue);

			info1.setGoodsValue(goodsValue);
			info1.setRemark("恩联商品供应新增");
			info1.setRechargeLimit("");
			try {
				goodsSupplyManageDAO.insert(info1);
			} catch (Exception e) {
				log.error(e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}
	}

	private void addJpayGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) {
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();
		info1.setSuppliersId(supplyId);
		info1.setSupplyName("捷易通");
		JieyitongGoodsInfo jInfo = this.jpayGoodsDAO
				.queryByGoodsId(originalGoodsId);
		if (jInfo != null) {
			// 进价
			String unitPrice = jInfo.getInPrice();
			int goodsCostPrice = DataConversion.toInt(unitPrice);
			info1.setGoodsCostPrice(goodsCostPrice);
			// 商品面值
			String parValue = jInfo.getParValue();
			int goodsValue = DataConversion.toInt(parValue);

			info1.setGoodsValue(goodsValue);
			info1.setRemark("捷易通商品供应新增");
			try {
				goodsSupplyManageDAO.insert(info1);
			} catch (Exception e) {
				log.error("捷易通商品供应新增时出现异常", e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

	}

	private void addEBaiMiGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) {
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();
		info1.setSuppliersId(supplyId);
		info1.setSupplyName("易百米");
		EbaimiProduct eInfo = this.eBaiMiDAO.queryByGoodsId(originalGoodsId);
		if (eInfo != null) {
			// 进价
			String unitPrice = eInfo.getSup_price();
			int goodsCostPrice = DataConversion.toInt(unitPrice);
			info1.setGoodsCostPrice(goodsCostPrice);
			// 商品面值
			String parValue = eInfo.getPrice();
			int goodsValue = DataConversion.toInt(parValue);

			info1.setGoodsValue(goodsValue);
			info1.setRemark("易百米商品供应新增");
			try {
				goodsSupplyManageDAO.insert(info1);
			} catch (Exception e) {
				log.error("易百米商品供应新增时出现异常", e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}
	}

	private void addWogreatGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) {
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();
		info1.setSuppliersId(supplyId);
		info1.setSupplyName("沃谷");
		WogreatProduct wInfo = this.wogreatDAO.queryByProId(originalGoodsId);
		if (wInfo != null) {
			// 进价
			String unitPrice = wInfo.getProductPrice();
			int goodsCostPrice = DataConversion.toInt(unitPrice);
			info1.setGoodsCostPrice(goodsCostPrice);
			// 商品面值
			String parValue = wInfo.getProductParvalue();
			int goodsValue = DataConversion.toInt(parValue);

			info1.setGoodsValue(goodsValue);
			info1.setRemark("沃谷商品供应新增");
			try {
				goodsSupplyManageDAO.insert(info1);
			} catch (Exception e) {
				log.error("沃谷商品供应新增时出现异常", e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}
	}

	private void addSnnsGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) {
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();
		info1.setSuppliersId(supplyId);
		info1.setSupplyName("7996");
		SevenNineNineSixProduct snns = this.sevenNineNineSixDAO
				.queryByProductId(originalGoodsId);
		if (snns != null) {
			// 进价
			String unitPrice = snns.getProductPrice();
			int goodsCostPrice = DataConversion.toInt(unitPrice);
			info1.setGoodsCostPrice(goodsCostPrice);
			// 商品面值
			String parValue = snns.getProductParvalue();
			int goodsValue = DataConversion.toInt(parValue);

			info1.setGoodsValue(goodsValue);
			info1.setRemark("7996商品供应新增");
			try {
				goodsSupplyManageDAO.insert(info1);
			} catch (Exception e) {
				log.error("7996商品供应新增时出现异常", e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}
	}

	private void addYunGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) {
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();
		info1.setSuppliersId(supplyId);
		info1.setSupplyName("云恩");
		YunEnProduct yun = this.yunDAO.queryByProductId(originalGoodsId);
		if (yun != null) {
			// 进价
			String unitPrice = yun.getProductPrice();
			int goodsCostPrice = DataConversion.toInt(unitPrice);
			info1.setGoodsCostPrice(goodsCostPrice);
			// 商品面值
			String parValue = yun.getProductParvalue();
			int goodsValue = DataConversion.toInt(parValue);

			info1.setGoodsValue(goodsValue);
			info1.setRemark("云恩商品供应新增");
			try {
				goodsSupplyManageDAO.insert(info1);
			} catch (Exception e) {
				log.error("云恩商品供应新增时出现异常", e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}
	}

	private void addXinHeGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) {
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();
		info1.setSuppliersId(supplyId);
		info1.setSupplyName("鑫合");
		XinHeProduct xin = this.xinHeProductDAO
				.queryByProductId(originalGoodsId);
		if (xin != null) {
			// 进价
			String unitPrice = xin.getProductPrice();
			int goodsCostPrice = DataConversion.toInt(unitPrice);
			info1.setGoodsCostPrice(goodsCostPrice);
			// 商品面值
			String parValue = xin.getProductParvalue();
			int goodsValue = DataConversion.toInt(parValue);

			info1.setGoodsValue(goodsValue);
			info1.setRemark("鑫合商品供应新增");
			try {
				goodsSupplyManageDAO.insert(info1);
			} catch (Exception e) {
				log.error("鑫合商品供应新增时出现异常", e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}
	}

	/**
	 * 向商品供应表，新增坚果网络产品
	 * 
	 * @param info
	 * @param info1
	 * @param head
	 * @throws ServerDisponseException
	 */
	private void addNutsNetGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) throws ServerDisponseException {
		info1.setRechargeLimit(""); // 坚果网络的充值数量限制在产品详细列表中，需要接口调用
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();

		info1.setSuppliersId(supplyId);
		info1.setSupplyName("坚果网络");

		NutsNetGoodsInfo nutsNetGoodsInfo = null;
		nutsNetGoodsInfo = nutsNetGoodsInfoDAO.queryById(originalGoodsId);
		if (nutsNetGoodsInfo != null) {
			// 商品进价
			String unitPrice = nutsNetGoodsInfo.getUnitPrice();
			int goodsCostPrice = DataConversion.toInt(unitPrice);
			info1.setGoodsCostPrice(goodsCostPrice);
			// 商品面值
			String parValueStr = nutsNetGoodsInfo.getParvalue();
			String value1 = DataConversion.converData(parValueStr);
			int parValue = Integer.parseInt(value1) * 1000; // 单位：厘

			info1.setGoodsValue(parValue);
			info1.setRemark("坚果网络商品供应新增");

			try {
				goodsSupplyManageDAO.insert(info1);

			} catch (Exception e) {
				log.error(e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}

		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}
	}

	/**
	 * 向商品供应表，新增恩付产品
	 * 
	 * @param info
	 * @param info1
	 */
	private void addEnfuGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) {
		info1.setRechargeLimit(""); //
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();

		info1.setSuppliersId(supplyId);
		info1.setSupplyName("恩付");

		// 商品编号
		String productid = null;
		EnfuGoodsDetailInfo enfuGoodsDetailInfo = enfuGoodsDetailDAO
				.queryGoodsDetail(originalGoodsId);
		if (enfuGoodsDetailInfo != null) {
			productid = enfuGoodsDetailInfo.getProductid();
		}
		EnfuGoodsInfo enInfo = null;
		enInfo = enfuGoodsDAO.queryEnfuGoodsInfoByProductid(productid);
		if (enInfo != null) {
			// 商品进价
			String unitPrice = enInfo.getBuyprice();
			int goodsCostPrice = DataConversion.toInt(unitPrice);
			info1.setGoodsCostPrice(goodsCostPrice);
			// 商品面值
			String parValueStr = enInfo.getParvalue();
			String value1 = DataConversion.converData(parValueStr);
			int parValue = Integer.parseInt(value1) * 1000; // 单位：厘
			info1.setGoodsValue(parValue);
			info1.setRemark("恩付商品供应新增");
			try {
				goodsSupplyManageDAO.insert(info1);
			} catch (Exception e) {
				log.error(e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}
	}

	/**
	 * 向商品供应表，新增殴飞产品
	 * 
	 * @param info
	 * @param info1
	 * @param head
	 * @throws ServerDisponseException
	 */
	private void addOhFeiGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) throws ServerDisponseException {
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();

		info1.setSuppliersId(supplyId);
		info1.setSupplyName("殴飞");
		OhFeiGoodsInfo ohFeiGoodsInfo = null;
		ohFeiGoodsInfo = ohFeiGoodsInfoDAO.queryById(originalGoodsId);
		if (ohFeiGoodsInfo != null) {
			// 进价
			String unitPrice = ohFeiGoodsInfo.getGoodsInPrice();
			int goodsCostPrice = DataConversion.toInt(unitPrice);
			info1.setGoodsCostPrice(goodsCostPrice);
			// 商品面值
			String parValue = ohFeiGoodsInfo.getParValue() + "";
			int goodsValue = DataConversion.converStringToInteger(parValue);

			info1.setGoodsValue(goodsValue);
			info1.setRemark("殴飞商品供应新增");
			info1.setRechargeLimit(ohFeiGoodsInfo.getAmounts());
			try {
				goodsSupplyManageDAO.insert(info1);

			} catch (Exception e) {
				log.error(e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}

		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

	}

	/**
	 * 向商品供应表，新增腾讯产品
	 * 
	 * @param info
	 * @param info1
	 * @param head
	 * @throws ServerDisponseException
	 */
	private void addTencentGoods(GoodsSupplyManageInfo info,
			GoodsSupplyManageInfo info1) throws ServerDisponseException {
		info1.setRechargeLimit("");
		// 供应商编号
		String supplyId = info.getSuppliersId();
		// 原始商品编号
		String originalGoodsId = info.getOriginalGoodsId();
		info1.setSuppliersId(supplyId);
		info1.setSupplyName("腾讯");

		TencentGoodsInfo tencentGoodsInfo = null;
		// 腾讯产品
		tencentGoodsInfo = tencentGoodsInfoDAO
				.queryGoodsInfoGoodsId(originalGoodsId);
		if (tencentGoodsInfo != null) {
			// 进价
			String unitPriceStr = tencentGoodsInfo.getInPrice();
			int unitPrice = DataConversion.converStringToInteger(unitPriceStr);
			info1.setGoodsCostPrice(unitPrice);
			// 商品面值
			int parValue = 1000; // 腾讯产品不显示面值 ,暂时设置为1元 单位：厘
			info1.setGoodsValue(parValue);
			info1.setRemark("腾讯商品供应新增");

			try {
				goodsSupplyManageDAO.insert(info1);
			} catch (Exception e) {
				log.error(e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}

		} else {
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

	}

	/**
	 * 手拉手商品信息处理
	 * 
	 * @param brandId
	 * @param head
	 * @param supplyId
	 * @param originalGoodsId
	 * @param operator
	 * @param priceRatio
	 */
	private String processSlsGoodsInfo(String brandId, Head head,
			String supplyId, String originalGoodsId, String operator,
			String goodsName, int priceRatio) {
		String maxGoodsId = null;
		String goodsId = "";
		//
		boolean isExist = isExistOfGoods(goodsName);
		if (!isExist) {
			maxGoodsId = goodsInfoManageDAO.queryMaxGoodsId();
			if ("".equals(maxGoodsId) || maxGoodsId == null) {
				goodsId = "100000000";
			} else {
				goodsId = ObjectIncreaseId.increaseObjectId(maxGoodsId);
			}

			insertSlsGoodsInfo(goodsId, head, supplyId, originalGoodsId,
					brandId, operator, priceRatio);
		} else {
			GoodsManageInfo goodsInfo = goodsInfoManageDAO
					.queryByGoodsName(goodsName);
			goodsId = goodsInfo.getGoodsId();
			// 原始供应商商品的价格
			String originalPrice = null;
			String originalParvalue = null;
			XingParvalueInfo parInfo = null;
			if ("20121000".equals(supplyId)) { // ============== 殴飞
				OhFeiGoodsInfo ohFeiGoodsInfo = ohFeiGoodsInfoDAO
						.queryById(originalGoodsId);
				if (ohFeiGoodsInfo != null) {
					originalPrice = ohFeiGoodsInfo.getGoodsInPrice();
					originalParvalue = ohFeiGoodsInfo.getParValue();
				}
			} else if ("20121001".equals(supplyId)) { // ==============坚果网络
				NutsNetGoodsInfo nutsNetGoodsInfo = queryNutsnetOriGoods(originalGoodsId);
				if (nutsNetGoodsInfo != null) {
					originalPrice = nutsNetGoodsInfo.getUnitPrice();
					originalParvalue = nutsNetGoodsInfo.getParvalue();
				}
			} else if ("20121002".equals(supplyId)) { // ==============腾讯
				TencentGoodsInfo tencentInfo = tencentGoodsInfoDAO
						.queryGoodsInfoGoodsId(originalGoodsId);
				if (tencentInfo != null) {
					originalPrice = tencentInfo.getInPrice();
				}
			} else if ("20121003".equals(supplyId)) { // 恩联
				EnLinkProduct enlink = this.enLinkProductDAO
						.queryByProductId(originalGoodsId);
				if (enlink != null) {
					originalPrice = enlink.getProductInPrice();
					originalParvalue = enlink.getProductParvalue();
				}
			} else if ("20121004".equals(supplyId)) { // 星启天
				parInfo = this.xingParvalueDAO
						.queryParvalueInfoByGoodsId(originalGoodsId);
				if (parInfo != null) {
					originalParvalue = parInfo.getParvalueId();
				}
			} else if ("20121005".equals(supplyId)) {
				JieyitongGoodsInfo jInfo = this.jpayGoodsDAO
						.queryByGoodsId(originalGoodsId);
				if (jInfo != null) {
					originalPrice = jInfo.getInPrice();
					originalParvalue = jInfo.getParValue();
				}
			} else if ("20121006".equals(supplyId)) {
				EbaimiProduct eInfo = this.eBaiMiDAO
						.queryByGoodsId(originalGoodsId);
				if (eInfo != null) {
					originalPrice = eInfo.getSup_price();
					originalParvalue = eInfo.getPrice();
				}
			} else if ("20121007".equals(supplyId)) { // 7996
				SevenNineNineSixProduct snns = this.sevenNineNineSixDAO
						.queryByProductId(originalGoodsId);
				if (snns != null) {
					originalPrice = snns.getProductPrice();
					originalParvalue = snns.getProductParvalue();
				}

			} else if ("20121008".equals(supplyId)) {
				WogreatProduct wp = this.wogreatDAO
						.queryByProId(originalGoodsId);
				if (wp != null) {
					originalPrice = wp.getProductPrice();
					originalParvalue = wp.getProductParvalue();
				}
			} else if ("20121009".equals(supplyId)) {
				YunEnProduct yunP = this.yunDAO
						.queryByProductId(originalGoodsId);
				if (yunP != null) {
					originalPrice = yunP.getProductPrice();
					originalParvalue = yunP.getProductParvalue();
				}
			} else if ("20121010".equals(supplyId)) { // 恩付
				// EnfuGoodsInfo enInfo = null;
				// enfuGoodsDAO
				// .queryByGoodsId(originalGoodsId);
				// if (enInfo != null) {
				// originalPrice = "";
				// // enInfo.getUnitPrice();
				// originalParvalue = enInfo.getParvalue();
				// }
			}
			String id = goodsInfo.getId();
			int parvalue = DataConversion.toInt(originalParvalue);
			int commSalePrice = 0;
			// 默认售价
			if ("20121004".equals(supplyId)) { // 星启天
				if (parInfo != null) {
					List<XingDisCountInfo> disInfoList = this.xingDisCountDAO
							.queryDiscountByProductId(parInfo.getProductid());
					if (disInfoList != null && disInfoList.size() > 0) {
						XingDisCountInfo disInfo = disInfoList.get(0);
						if (disInfo != null) {
							String discount = disInfo.getRecordSalePrice();
							commSalePrice = DataConversion.cal(
									originalParvalue, discount);
						}
					} else {
						XingParvalueInfo parva = this.xingParvalueDAO
								.queryParvalueInfoByGoodsId(originalGoodsId);
						if (parva != null) {
							String discount = parva.getSaleprice();
							commSalePrice = DataConversion.cal(
									originalParvalue, discount);
						}
					}
				}
			} else if (StringUtils.isNotEmpty(EKHInterfaceserviceImp
					.getDealName(supplyId))) {
				// TODO
				GoodsSupplyManageInfo querysupply = null;
				try {
					String dealname = EKHInterfaceserviceImp
							.getDealName(supplyId);
					BaseDeal basedeal = (BaseDeal) StartMain.APPLICATION_CONTEXT
							.getBean(dealname);
					querysupply = basedeal.querySupplyprice(originalGoodsId);
				} catch (Exception e) {
					log.error("进入Service开始处理获取进货价查询请求,上游商品信息 查询异常:"
							+ originalGoodsId + "|" + e);
				}
				if (querysupply == null) {
					commSalePrice = DataConversion.toInt(originalPrice);
					parvalue = DataConversion.toInt(originalParvalue);
				} else {
					commSalePrice = querysupply.getGoodsCostPrice();
					parvalue = querysupply.getGoodsValue();
				}
			} else {
				commSalePrice = DataConversion.toInt(originalPrice);
			}

			double d = commSalePrice * priceRatio * 1.0 / 1000;
			long l = Math.round(d);
			Long lo = new Long(l);
			int discountPrice = lo.intValue();
			commSalePrice = commSalePrice + discountPrice;
			GoodsManageInfo info = new GoodsManageInfo();
			info.setId(id);
			info.setModifyTime(ServerDateAndTime.getNowDateTimeOfFormat());
			info.setCommonSalePrice(commSalePrice);
			info.setGoodsMoney(parvalue);
			this.goodsInfoManageDAO.update(info);
		}
		return goodsId;
	}

	/**
	 * 向商品信息表插入数据
	 * 
	 * @param goodsId
	 * @param head
	 * @param supplyId
	 * @param originalGoodsId
	 * @param brandId
	 * @param operator
	 * @param priceRatio
	 */
	private void insertSlsGoodsInfo(String goodsId, Head head, String supplyId,
			String originalGoodsId, String brandId, String operator,
			int priceRatio) {
		GoodsManageInfo goodsManageInfo1 = new GoodsManageInfo();
		goodsManageInfo1.setGoodsId(goodsId);
		goodsManageInfo1 = obtainSlsGoodsInfo(supplyId, originalGoodsId,
				goodsManageInfo1, head);
		goodsManageInfo1.setId(UUID.randomUUID().toString());
		// 可充值数量【不同供应商提供的产品，可充值数量不一样，此属性放到供应表中的"充值限制"属性中】
		String numLimit = "";
		goodsManageInfo1.setNumLimit(numLimit);
		goodsManageInfo1.setGoodsCategoryId(brandId);
		// 默认售价
		int commSalePrice = goodsManageInfo1.getCommonSalePrice();
		double d = commSalePrice * priceRatio * 1.0 / 1000;
		long l = Math.round(d);
		Long lo = new Long(l);
		int discountPrice = lo.intValue();
		commSalePrice = commSalePrice + discountPrice;
		goodsManageInfo1.setCommonSalePrice(commSalePrice);
		// //---------------------------------- 默认售价
		goodsManageInfo1.setGoodsState("1"); // 0:商品下架 1：商品上架
		goodsManageInfo1.setGoodsDescription("");
		goodsManageInfo1.setEnable("1"); // 0：不启用 1:启用
		goodsManageInfo1.setRechargeArea("");
		goodsManageInfo1.setStateMent("");
		goodsManageInfo1.setRemark("");
		goodsManageInfo1.setOperator(operator);
		// 根据品牌Id，查询品牌名称
		ProductBrandInfo productBrandInfo = null;
		productBrandInfo = productBrandDAO.queryById(brandId);
		// 品牌名称
		String brandName = "";
		if (productBrandInfo != null) {
			brandName = productBrandInfo.getGameName();
		}
		goodsManageInfo1.setBrandName(brandName);
		// 记录插入时间
		String now = ServerDateAndTime.getNowDateTimeOfFormat();
		goodsManageInfo1.setInsertTime(now);
		try {
			goodsInfoManageDAO.insert(goodsManageInfo1);
		} catch (Exception e) {
			log.error(e);
			throw new ServerDisponseException(
					ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
					ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
		}
	}

	/**
	 * 商品插入之前，判断该条商品是否存在
	 * 
	 * @param goodsName
	 * @param supplyId
	 * @return
	 */
	private boolean isExistOfGoods(String goodsName) {
		boolean flag = false;
		GoodsManageInfo info = null;
		info = goodsInfoManageDAO.queryByGoodsName(goodsName);
		if (info != null) {
			flag = true;
		}
		return flag;
	}

	/**
	 * 获取Sls商品信息对象中的相关属性
	 * 
	 * @param supplyId
	 * @param originalGoodsId
	 * @param goodsManageInfo1
	 * @param head
	 */
	private GoodsManageInfo obtainSlsGoodsInfo(String supplyId,
			String originalGoodsId, GoodsManageInfo goodsManageInfo1, Head head) {
		GoodsManageInfo goodsManageInfo = null;
		if ("20121000".equals(supplyId)) { // ============== 殴飞
			goodsManageInfo = addGoodsOfOhFei(originalGoodsId,
					goodsManageInfo1, head);
		} else if ("20121001".equals(supplyId)) { // ==============坚果网络
			goodsManageInfo = addGoodsOfNutsNet(originalGoodsId,
					goodsManageInfo1, head);

		} else if ("20121002".equals(supplyId)) { // ==============腾讯
			goodsManageInfo = addGoodsOfTencent(originalGoodsId,
					goodsManageInfo1, head);
		} else if ("20121003".equals(supplyId)) {// ===========恩联
			goodsManageInfo = getEnLinkProduct(originalGoodsId,
					goodsManageInfo1, head);
		} else if ("20121004".equals(supplyId)) {// 星启天
			goodsManageInfo = getXQTProduct(originalGoodsId, goodsManageInfo1,
					head);
		} else if ("20121005".equals(supplyId)) {// 捷易通
			goodsManageInfo = getJpayProduct(originalGoodsId, goodsManageInfo1,
					head);
		} else if ("20121006".equals(supplyId)) {// 易百米
			goodsManageInfo = getEbaiMiProduct(originalGoodsId,
					goodsManageInfo1, head);
		} else if ("20121007".equals(supplyId)) {// 7996
			goodsManageInfo = getSnnsProduct(originalGoodsId, goodsManageInfo1,
					head);
		} else if ("20121008".equals(supplyId)) {// 沃谷
			goodsManageInfo = getWogeatProduct(originalGoodsId,
					goodsManageInfo1, head);
		} else if ("20121009".equals(supplyId)) {// 云恩
			goodsManageInfo = getYunProduct(originalGoodsId, goodsManageInfo1,
					head);
		}else{
			
			//TODO
			String dealname = EKHInterfaceserviceImp.getDealName(supplyId);
			if (StringUtils.isNotEmpty(dealname)) {
				try {
					BaseDeal basedeal = (BaseDeal) StartMain.APPLICATION_CONTEXT
							.getBean(dealname);
					goodsManageInfo = basedeal
							.getProductFromProduct(originalGoodsId,
									goodsManageInfo1, head);
				} catch (Exception e) {
					log.error("进入Service开始处理获取进货价查询请求,上游商品信息 查询异常:"
							+ originalGoodsId + "|" + e);
				}
			}
		}
		return goodsManageInfo;
	}

	private GoodsManageInfo getSnnsProduct(String originalGoodsId,
			GoodsManageInfo goodsManageInfo1, Head head) {
		String goodsName = "";
		SevenNineNineSixProduct snns = this.sevenNineNineSixDAO
				.queryByProductId(originalGoodsId);
		if (snns != null) {
			// 商品名称
			goodsName = snns.getProductName();
			// 商品面值
			String parValueOri = snns.getProductParvalue();
			int parValue = DataConversion.toInt(parValueOri); // 单位转换为厘
			String inPrice = snns.getProductPrice();
			int inPrice2 = DataConversion.toInt(inPrice);
			// 官方网址
			String officialUrl = "";
			// 充值方式
			String rechargeMode = "2";

			goodsManageInfo1.setGoodsMoney(parValue);
			goodsManageInfo1.setCommonSalePrice(inPrice2);
			goodsManageInfo1.setOfficialUrl(officialUrl);
			goodsManageInfo1.setRechargeMode(rechargeMode);
			goodsManageInfo1.setGoodsName(goodsName);
		} else {
			log.error("原始商品不存在！");
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

		return goodsManageInfo1;
	}

	private GoodsManageInfo getYunProduct(String originalGoodsId,
			GoodsManageInfo goodsManageInfo1, Head head) {
		String goodsName = "";
		YunEnProduct yun = this.yunDAO.queryByProductId(originalGoodsId);
		if (yun != null) {
			// 商品名称
			goodsName = yun.getProductName();
			// 商品面值
			String parValueOri = yun.getProductParvalue();
			int parValue = DataConversion.toInt(parValueOri); // 单位转换为厘
			String inPrice = yun.getProductPrice();
			int inPrice2 = DataConversion.toInt(inPrice);
			// 充值方式
			String rechargeMode = yun.getRechargeMode();

			goodsManageInfo1.setGoodsMoney(parValue);
			goodsManageInfo1.setCommonSalePrice(inPrice2);
			goodsManageInfo1.setRechargeMode(rechargeMode);
			goodsManageInfo1.setGoodsName(goodsName);
		} else {
			log.error("原始商品不存在！");
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

		return goodsManageInfo1;
	}

	private GoodsManageInfo getEbaiMiProduct(String originalGoodsId,
			GoodsManageInfo goodsManageInfo1, Head head) {
		String goodsName = "";
		EbaimiProduct ebaimi = this.eBaiMiDAO.queryByGoodsId(originalGoodsId);
		if (ebaimi != null) {
			// 商品名称
			goodsName = ebaimi.getName_goods();
			// 商品面值
			String parValueOri = ebaimi.getPrice();
			int parValue = DataConversion.toInt(parValueOri); // 单位转换为厘
			String inPrice = ebaimi.getSup_price();
			int inPrice2 = DataConversion.toInt(inPrice);
			// 官方网址
			String officialUrl = "";
			// 充值方式
			String rechargeMode = "2";

			goodsManageInfo1.setGoodsMoney(parValue);
			goodsManageInfo1.setCommonSalePrice(inPrice2);
			goodsManageInfo1.setOfficialUrl(officialUrl);
			goodsManageInfo1.setRechargeMode(rechargeMode);
			goodsManageInfo1.setGoodsName(goodsName);
		} else {
			log.error("原始商品不存在！");
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

		return goodsManageInfo1;

	}

	private GoodsManageInfo getWogeatProduct(String originalGoodsId,
			GoodsManageInfo goodsManageInfo1, Head head) {
		String goodsName = "";
		WogreatProduct wogreat = this.wogreatDAO.queryByProId(originalGoodsId);
		if (wogreat != null) {
			// 商品名称
			goodsName = wogreat.getProductName();
			// 商品面值
			String parValueOri = wogreat.getProductParvalue();
			int parValue = DataConversion.toInt(parValueOri); // 单位转换为厘
			String inPrice = wogreat.getProductPrice();
			int inPrice2 = DataConversion.toInt(inPrice);
			// 官方网址
			String officialUrl = "";
			// 充值方式
			String rechargeMode = "";
			String type = wogreat.getRechargeMode();
			if ("2".equals(type)) {
				rechargeMode = "2";
			} else {
				rechargeMode = "1";
			}

			goodsManageInfo1.setGoodsMoney(parValue);
			goodsManageInfo1.setCommonSalePrice(inPrice2);
			goodsManageInfo1.setOfficialUrl(officialUrl);
			goodsManageInfo1.setRechargeMode(rechargeMode);
			goodsManageInfo1.setGoodsName(goodsName);
		} else {
			log.error("原始商品不存在！");
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

		return goodsManageInfo1;
	}

	private GoodsManageInfo getXQTProduct(String originalGoodsId,
			GoodsManageInfo goodsManageInfo1, Head head) {
		String goodsName = null;
		XingParvalueInfo parvalueInfo = this.xingParvalueDAO
				.queryParvalueInfoByGoodsId(originalGoodsId);
		if (parvalueInfo != null) {
			// 商品名称
			goodsName = parvalueInfo.getGametype()
					+ parvalueInfo.getParvalueName();
			// 商品面值
			String parValueOri = parvalueInfo.getParvalueId();
			int parValue = DataConversion.toInt(parValueOri); // 单位转换为厘
			// 商品进价
			List<XingDisCountInfo> discountInfoList = this.xingDisCountDAO
					.queryDiscountByProductId(parvalueInfo.getProductid());
			int inPrice = 0;
			if (discountInfoList != null && discountInfoList.size() > 0) {
				XingDisCountInfo discountInfo = discountInfoList.get(0);
				if (discountInfo != null) {
					String discountStr = discountInfo.getRecordSalePrice();
					inPrice = DataConversion.cal(parValueOri, discountStr); // 单位转换为厘
				}
			}
			// 官方网址
			String officialUrl = "";
			// 充值方式
			String rechargeMode = "2";
			goodsManageInfo1.setGoodsMoney(parValue);
			goodsManageInfo1.setCommonSalePrice(inPrice);
			goodsManageInfo1.setOfficialUrl(officialUrl);
			goodsManageInfo1.setRechargeMode(rechargeMode);
			goodsManageInfo1.setGoodsName(goodsName);

		} else {
			log.error("原始商品不存在！");
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}
		return goodsManageInfo1;
	}

	private GoodsManageInfo getEnLinkProduct(String originalGoodsId,
			GoodsManageInfo goodsManageInfo1, Head head) {
		EnLinkProduct enlink = null;
		String goodsName = "";
		enlink = this.enLinkProductDAO.queryByProductId(originalGoodsId);
		if (enlink != null) {
			// 商品名称
			goodsName = enlink.getProductName();
			// 商品面值
			String parValueOri = enlink.getProductParvalue();
			int parValue = DataConversion.toInt(parValueOri); // 单位转换为厘
			String inPrice = enlink.getProductInPrice();
			int inPrice2 = DataConversion.toInt(inPrice);
			// 官方网址
			String officialUrl = "";
			// 充值方式
			String rechargeMode = enlink.getProductType();

			goodsManageInfo1.setGoodsMoney(parValue);
			goodsManageInfo1.setCommonSalePrice(inPrice2);
			goodsManageInfo1.setOfficialUrl(officialUrl);
			goodsManageInfo1.setRechargeMode(rechargeMode);
			goodsManageInfo1.setGoodsName(goodsName);
		} else {
			log.error("原始商品不存在！");
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

		return goodsManageInfo1;

	}

	private GoodsManageInfo getJpayProduct(String originalGoodsId,
			GoodsManageInfo goodsManageInfo1, Head head) {
		JieyitongGoodsInfo jInfo = this.jpayGoodsDAO
				.queryByGoodsId(originalGoodsId);
		String goodsName = null;
		if (jInfo != null) {
			// 商品名称
			goodsName = jInfo.getGoodsName();
			// 商品面值
			String parValueOri = jInfo.getParValue();
			int parValue = DataConversion.toInt(parValueOri); // 单位转换为厘
			String inPrice = jInfo.getInPrice();
			int inPrice2 = DataConversion.toInt(inPrice);
			// 官方网址
			String officialUrl = "";
			// 充值方式
			String rechargeMode = jInfo.getRechargeType();

			goodsManageInfo1.setGoodsMoney(parValue);
			goodsManageInfo1.setCommonSalePrice(inPrice2);
			goodsManageInfo1.setOfficialUrl(officialUrl);
			goodsManageInfo1.setRechargeMode(rechargeMode);
			goodsManageInfo1.setGoodsName(goodsName);
		} else {
			log.error("原始商品不存在！");
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

		return goodsManageInfo1;
	}

	/**
	 * 新增商品为腾讯产品
	 * 
	 * @param originalGoodsId
	 * @param goodsName
	 * @param goodsManageInfo1
	 * @param head
	 * @return
	 */
	private GoodsManageInfo addGoodsOfTencent(String originalGoodsId,
			GoodsManageInfo goodsManageInfo1, Head head) {
		TencentGoodsInfo info = null;
		String goodsName = "";
		info = tencentGoodsInfoDAO.queryGoodsInfoGoodsId(originalGoodsId);
		if (info != null) {
			// 商品名称
			goodsName = info.getProductName();
			// 充值方式
			String rechargeMode = info.getRechargeMode();
			String inPrice = info.getInPrice();
			int commonSalePrice = DataConversion.toInt(inPrice);
			goodsManageInfo1.setCommonSalePrice(commonSalePrice);
			goodsManageInfo1.setGoodsName(goodsName);
			goodsManageInfo1.setRechargeMode(rechargeMode);
			goodsManageInfo1.setGoodsName(goodsName);
		} else {
			log.error("Service处理[" + head.getRequestId() + "]的请求，原始商品不存在！");
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

		return goodsManageInfo1;
	}

	/**
	 * 新增商品为坚果网络商品
	 * 
	 * @param originalGoodsId
	 * @param goodsName
	 * @param goodsManageInfo1
	 * @param head
	 * @return
	 */
	private GoodsManageInfo addGoodsOfNutsNet(String originalGoodsId,
			GoodsManageInfo goodsManageInfo1, Head head) {
		NutsNetGoodsInfo nutsNetGoodsInfo = null;
		String goodsName = "";
		// 根据原始商品Id，查询单条记录
		nutsNetGoodsInfo = queryNutsnetOriGoods(originalGoodsId);
		if (nutsNetGoodsInfo != null) {
			String name = nutsNetGoodsInfo.getName();
			String[] strArr = new String[3];
			strArr = name.split("-");
			// 商品名称
			goodsName = strArr[1] + strArr[2];
			String parValueStr = nutsNetGoodsInfo.getParvalue();
			String unitPrice = nutsNetGoodsInfo.getUnitPrice();
			int index = -1;
			index = parValueStr.indexOf(".");
			if (index != -1) {
				parValueStr = parValueStr.substring(0, index);
			}

			// 商品面值
			int parValue = Integer.parseInt(parValueStr) * 1000; // 单位：厘
			// 售价
			int priceSale = DataConversion.toInt(unitPrice);
			// 官方网址
			String officialUrl = "";
			// 充值方式
			String rechargeMode = nutsNetGoodsInfo.getProductType();

			goodsManageInfo1.setGoodsMoney(parValue);
			goodsManageInfo1.setCommonSalePrice(priceSale);
			goodsManageInfo1.setOfficialUrl(officialUrl);
			goodsManageInfo1.setRechargeMode(rechargeMode);
			goodsManageInfo1.setGoodsName(goodsName);
		} else {
			log.error("Service处理[" + head.getRequestId() + "]的请求，原始商品不存在！");
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

		return goodsManageInfo1;
	}

	/**
	 * 查询坚果网络原始产品
	 * 
	 * @param originalGoodsId
	 */
	private NutsNetGoodsInfo queryNutsnetOriGoods(String originalGoodsId) {
		NutsNetGoodsInfo info = null;
		info = nutsNetGoodsInfoDAO.queryById(originalGoodsId);
		return info;
	}

	/**
	 * 新增商品为殴飞商品
	 * 
	 * @param originalGoodsId
	 * @param goodsName
	 * @param goodsManageInfo1
	 * @param head
	 * @return
	 */
	private GoodsManageInfo addGoodsOfOhFei(String originalGoodsId,
			GoodsManageInfo goodsManageInfo1, Head head) {
		OhFeiGoodsInfo ohFeiGoodsInfo = null;
		String goodsName = "";
		ohFeiGoodsInfo = ohFeiGoodsInfoDAO.queryById(originalGoodsId);
		if (ohFeiGoodsInfo != null) {
			// 商品名称
			goodsName = ohFeiGoodsInfo.getGoodsName();
			// 商品面值
			String parValueOri = ohFeiGoodsInfo.getParValue();
			int parValue = DataConversion.toInt(parValueOri); // 单位转换为厘
			String inPrice = ohFeiGoodsInfo.getGoodsInPrice();
			int inPrice2 = DataConversion.toInt(inPrice);
			// 官方网址
			String officialUrl = ohFeiGoodsInfo.getFullCostsite();
			// 充值方式
			String rechargeMode = ohFeiGoodsInfo.getClassType();

			goodsManageInfo1.setGoodsMoney(parValue);
			goodsManageInfo1.setCommonSalePrice(inPrice2);
			goodsManageInfo1.setOfficialUrl(officialUrl);
			if ("3".equals(rechargeMode)) {
				goodsManageInfo1.setRechargeMode("1");
			} else {
				goodsManageInfo1.setRechargeMode("2");
			}

			goodsManageInfo1.setGoodsName(goodsName);
		} else {
			log.error("Service处理[" + head.getRequestId() + "]的请求，原始商品不存在！");
			throw new ServerDisponseException(
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getCode(),
					ExceptionCodeDes.ORIGINAL_GOODS_NOT_EXTIS.getDescription());
		}

		return goodsManageInfo1;
	}

	/**
	 * 手拉手品牌处理
	 * 
	 * @param brandName
	 * @param supplyId
	 * @param originalGoodsId
	 * @param operator
	 */
	private String processSlsBrand(String brandName, String supplyId,
			String originalGoodsId, String operator) {
		String brandId = "";
		// 根据品牌名称，查询品牌表
		List<ProductBrandInfo> brandList = null;
		ProductBrandInfo productBrandInfo = new ProductBrandInfo();
		productBrandInfo.setGameName(brandName);
		productBrandInfo.setIsDelete("1");

		brandList = this.productBrandDAO.queryByBrandName(productBrandInfo);
		if (brandList == null || brandList.isEmpty()) {
			// 查询最大品牌编号
			String brandMaxIdStr = productBrandDAO.query();
			if ("".equals(brandMaxIdStr) || brandMaxIdStr == null) {
				brandId = "100000000";
			} else {
				brandId = ObjectIncreaseId.increaseObjectId(brandMaxIdStr);
			}

			insertSlsBrand(brandName, brandId, operator);
		} else {
			ProductBrandInfo brandInfo = brandList.get(0);
			brandId = brandInfo.getGoodsCategoryId();
			String modifyTime = ServerDateAndTime.getNowDateTimeOfFormat();
			String id = brandInfo.getId();
			ProductBrandInfo brand = new ProductBrandInfo();
			brand.setId(id);
			brand.setModifyTime(modifyTime);
			this.productBrandDAO.update(brand);
		}

		return brandId;
	}

	/**
	 * 向手拉手品牌表插入数据
	 * 
	 * @param brandName
	 * @param brandId
	 * @param operator
	 */
	private void insertSlsBrand(String brandName, String brandId,
			String operator) {
		// 插入数据之前，判断该条记录是否存在
		boolean isExist = isExistOfBrand(brandName, "1");
		if (isExist) {
			ProductBrandInfo productBrandInfo1 = new ProductBrandInfo();
			productBrandInfo1.setId(UUID.randomUUID().toString());
			productBrandInfo1.setGoodsCategoryId(brandId);
			productBrandInfo1.setGameName(brandName);
			productBrandInfo1.setInitDisplay("1"); // 1表示门店加载时就显示 0表示否
			productBrandInfo1.setEnable("1"); // 1表示启用 0 表示禁用
			productBrandInfo1.setIsDelete("1"); // 0：表示删除，1：不删除
			productBrandInfo1.setRemark("");
			productBrandInfo1.setOperator(operator);
			// 插入时间
			String now = ServerDateAndTime.getNowDateTimeOfFormat();
			productBrandInfo1.setInsertTime(now);
			try {
				productBrandDAO.insert(productBrandInfo1);
			} catch (Exception e) {
				log.error(e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		}
	}

	/**
	 * 插入数据之前，判断该条记录是否存在
	 * 
	 * @param brandName
	 * @param isDelete
	 * @return
	 */
	private boolean isExistOfBrand(String brandName, String isDelete) {
		boolean flag = false;
		List<ProductBrandInfo> productBrandInfo = null;
		ProductBrandInfo productBrandInfo2 = new ProductBrandInfo();
		productBrandInfo2.setGameName(brandName);
		productBrandInfo2.setIsDelete(isDelete);
		productBrandInfo = productBrandDAO.queryByBrandName(productBrandInfo2);
		if (productBrandInfo == null || productBrandInfo.isEmpty()) {
			flag = true;
		}

		return flag;
	}

	/**
	 * 获取品牌名称
	 * 
	 * @param supplyId
	 * @param originalGoodsId
	 * @return
	 */
	// private String obtainBrandName(String supplyId, String originalGoodsId) {
	// String brandName = null;
	// if ("20121000".equals(supplyId)) { // 殴飞
	// OhFeiGoodsInfo ohFeiGoodsInfo = null;
	// ohFeiGoodsInfo = ohFeiGoodsInfoDAO.queryById(originalGoodsId);
	// // 品牌编号
	// String subClassId = ohFeiGoodsInfo.getSubClassId();
	// OhFeiGoodsBrandInfo info = null;
	// info = ohFeiGoodsBrandDAO.queryByCardId(subClassId);
	// if (info != null) {
	// brandName = info.getCardname();
	// }
	//
	// } else if ("20121001".equals(supplyId)) { // 坚果网络
	// NutsNetGoodsInfo info = null;
	// info = nutsNetGoodsInfoDAO.queryById(originalGoodsId);
	// if (info != null) {
	// String name = info.getName();
	// String[] nameArr = new String[3];
	// nameArr = name.split("-");
	// brandName = nameArr[1];
	// }
	//
	// } else if ("20121002".equals(supplyId)) { // 腾讯
	// TencentGoodsInfo tencentInfo = new TencentGoodsInfo();
	// tencentInfo = tencentGoodsInfoDAO
	// .queryGoodsInfoGoodsId(originalGoodsId);
	// String name = tencentInfo.getProductName();
	// brandName = name;
	// }
	//
	// return brandName;
	// }

	/**
	 * 殴飞产品审核完成
	 * 
	 * @param body
	 * @param head
	 * @return
	 * @throws ServerDisponseException
	 */
	@Override
	public String saveAuditOhFeiGoods(String body, Head head)
			throws ServerDisponseException {
		if (log.isInfoEnabled()) {
			log.info("进入Service开始处理[" + head.getRequestId() + "]的请求");
		}
		// 对消息body进行解析
		final OhFeiGoodsInfo ohFeiGoodsInfo = gson.fromJson(body,
				OhFeiGoodsInfo.class);
		final Head head2 = head;
		new Thread(new Runnable() {
			@Override
			public void run() {
				boolean flag = checkDataOfOhFeiGoods(ohFeiGoodsInfo,
						head2.getRequestId());
				if (flag) { // 数据校验通过
					// 产品品牌
					String brandName = null;
					// 商品名称
					String goodsName = null;
					// 价格利率
					int priceRatio = ohFeiGoodsInfo.getPriceRatio();
					List<OhFeiGoodsInfo> ohFeiList = ohFeiGoodsInfoDAO
							.queryAllGoodsInfo();
					for (OhFeiGoodsInfo ohFeiInfo : ohFeiList) {
						if (ohFeiInfo != null) {
							// 商品名称
							goodsName = ohFeiInfo.getGoodsName();
							// 商品品牌Id(四位)
							String subClassId = ohFeiInfo.getSubClassId();
							OhFeiGoodsBrandInfo ohFeiGoodsBrandInfo = ohFeiGoodsBrandDAO
									.queryByCardId(subClassId);
							if (ohFeiGoodsBrandInfo != null) {
								// 商品品牌名称
								brandName = ohFeiGoodsBrandInfo.getCardname();
							}
						} else {
							throw new ServerDisponseException(
									ExceptionCodeDes.DATABASE_RECORDS_NOT_EXITS
											.getCode(),
									ExceptionCodeDes.DATABASE_RECORDS_NOT_EXITS
											.getDescription());
						}

						String supplierId = ohFeiGoodsInfo.getSuppliersId();
						String operator = ohFeiGoodsInfo.getOperator();
						String originalGoodsId = ohFeiInfo.getGoodsId();
						// 手拉手品牌处理
						String brandId = processSlsBrand(brandName, supplierId,
								originalGoodsId, operator);
						// 手拉手商品信息处理
						String goodsId = processSlsGoodsInfo(brandId, head2,
								supplierId, originalGoodsId, operator,
								goodsName, priceRatio);
						// 手拉手商品供应处理
						processSlsGoodsSupply(goodsId, supplierId,
								originalGoodsId, operator);

						OhFeiGoodsInfo ohfei = new OhFeiGoodsInfo();
						ohfei.setGoodsId(originalGoodsId);
						ohfei.setIsAudit("1");
						ohFeiGoodsInfoDAO.updateState(ohfei);
					}
				}
			}

		}).start();

		return null;
	}

	/**
	 * 腾讯产品审核完成<br>
	 * 
	 * @param body
	 * @param head
	 * @return
	 * @throws ServerDisponseException
	 */
	@Override
	public String saveAuditTencentGoods(String body, Head head)
			throws ServerDisponseException {
		if (log.isInfoEnabled()) {
			log.info("进入Service开始处理[" + head.getRequestId() + "]的请求");
		}
		// 对消息body进行解析
		TencentGoodsInfo tencentGoodsInfo = gson.fromJson(body,
				TencentGoodsInfo.class);
		boolean flag = checkDataOfTencentGoods(tencentGoodsInfo,
				head.getRequestId());
		if (flag) { // 数据校验通过
			try {
				// 产品品牌
				String brandName = null;
				// 商品名称
				String goodsName = null;
				// 价格利率
				int priceRatio = tencentGoodsInfo.getPriceRatio();
				List<TencentGoodsInfo> TenGoodsList = this.tencentGoodsInfoDAO
						.queryAllGoodsInfo();
				if (TenGoodsList != null && !TenGoodsList.isEmpty()) {
					for (TencentGoodsInfo tenInfo : TenGoodsList) {
						if (tenInfo != null) {
							goodsName = tenInfo.getProductName();
							brandName = goodsName;
							String supplierId = tencentGoodsInfo
									.getSupplierId();
							String operator = tencentGoodsInfo.getOperator();
							String originalGoodsId = tenInfo.getGoodsId();
							// 手拉手品牌处理
							String brandId = processSlsBrand(brandName,
									supplierId, originalGoodsId, operator);
							// 手拉手商品信息处理
							String goodsId = processSlsGoodsInfo(brandId, head,
									supplierId, originalGoodsId, operator,
									goodsName, priceRatio);
							// 手拉手商品供应处理
							this.processSlsGoodsSupply(goodsId, supplierId,
									originalGoodsId, operator);

							TencentGoodsInfo tencent = new TencentGoodsInfo();
							tencent.setGoodsId(originalGoodsId);
							tencent.setIsAudit("1");
							this.tencentGoodsInfoDAO.updateState(tencent);
						}
					}
				}

			} catch (Exception e) {
				log.error(e);
				throw new ServerDisponseException(
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
						ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
			}
		}

		return null;
	}

	@Override
	public String saveAuditEnLinkGoods(String body, Head head)
			throws ServerDisponseException {
		EnLinkProduct enlink = gson.fromJson(body, EnLinkProduct.class);
		validateEnLinkData(enlink);
		// 产品品牌
		String brandName = null;
		// 商品名称
		String goodsName = null;
		// 价格利率
		int priceRatio = enlink.getPriceRatio();
		List<EnLinkProduct> enLinkProductList = null;
		try {
			enLinkProductList = this.enLinkProductDAO.queryAllProductInfo("1");
		} catch (Exception e) {
			log.error(e);
			throw new ServerDisponseException(
					ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
					ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
		}
		if (enLinkProductList != null && !enLinkProductList.isEmpty()) {
			for (EnLinkProduct enLinkProduct : enLinkProductList) {
				if (enLinkProduct != null) {
					goodsName = enLinkProduct.getProductName();
					brandName = goodsName;
					String supplierId = enlink.getSuppliersId();
					String operator = enlink.getOperator();
					String originalGoodsId = enLinkProduct.getProductId();
					// 手拉手品牌处理
					String brandId = processSlsBrand(brandName, supplierId,
							originalGoodsId, operator);
					// 手拉手商品信息处理
					String goodsId = processSlsGoodsInfo(brandId, head,
							supplierId, originalGoodsId, operator, goodsName,
							priceRatio);
					// 手拉手商品供应处理
					this.processSlsGoodsSupply(goodsId, supplierId,
							originalGoodsId, operator);

					EnLinkProduct en = new EnLinkProduct();
					en.setProductId(originalGoodsId);
					en.setIsAudit("1");
					try {
						this.enLinkProductDAO.updateState(en);
					} catch (Exception e) {
						log.error(e);
						throw new ServerDisponseException(
								ExceptionCodeDes.ACCESS_DATABASE_ERROR
										.getCode(),
								ExceptionCodeDes.ACCESS_DATABASE_ERROR
										.getDescription());
					}
				}
			}
		}
		return null;
	}

	@Override
	public void saveAuditJpayGoods(String body, Head head)
			throws ServerDisponseException {
		final JieyitongGoodsInfo jpayInfo = gson.fromJson(body,
				JieyitongGoodsInfo.class);
		final Head head2 = head;
		validateJpayData(jpayInfo);
		new Thread(new Runnable() {

			@Override
			public void run() {
				// 产品品牌
				String brandName = null;
				// 商品名称
				String goodsName = null;
				// 价格利率
				int priceRatio = jpayInfo.getPriceRatio();
				JieyitongGoodsInfo isAudit = new JieyitongGoodsInfo();
				isAudit.setIsAudit("0");
				List<JieyitongGoodsInfo> jList = jpayGoodsDAO
						.queryAllJpayInfo(isAudit);
				if (jList != null && !jList.isEmpty()) {
					for (JieyitongGoodsInfo jInfo : jList) {
						if (jInfo != null) {
							goodsName = jInfo.getGoodsName();
							brandName = goodsName;
							String supplierId = jpayInfo.getSupplierId();
							String operator = jpayInfo.getOperator();
							String originalGoodsId = jInfo.getGoodsId();
							// 手拉手品牌处理
							String brandId = processSlsBrand(brandName,
									supplierId, originalGoodsId, operator);
							// 手拉手商品信息处理
							String goodsId = processSlsGoodsInfo(brandId,
									head2, supplierId, originalGoodsId,
									operator, goodsName, priceRatio);
							// 手拉手商品供应处理
							processSlsGoodsSupply(goodsId, supplierId,
									originalGoodsId, operator);

							JieyitongGoodsInfo jpInfo = new JieyitongGoodsInfo();
							jpInfo.setId(jInfo.getId());
							jpInfo.setIsAudit("1");
							jpInfo.setModifyTime(ServerDateAndTime
									.getNowDateTimeOfFormat());
							try {
								jpayGoodsDAO.update(jpInfo);
							} catch (Exception e) {
								log.error("捷易通商品审核异常", e);
								throw new ServerDisponseException(
										ExceptionCodeDes.ACCESS_DATABASE_ERROR
												.getCode(),
										ExceptionCodeDes.ACCESS_DATABASE_ERROR
												.getDescription());
							}
						}
					}
				}
			}
		}).start();
	}

	@Override
	public void saveAuditEBaiMiGoods(String body, Head head)
			throws ServerDisponseException {
		final EbaimiProduct eInfo = gson.fromJson(body, EbaimiProduct.class);
		final Head head2 = head;
		this.validateEBaiMiData(eInfo);
		new Thread(new Runnable() {

			@Override
			public void run() {
				// 产品品牌
				String brandName = null;
				// 商品名称
				String goodsName = null;
				// 价格利率
				int priceRatio = eInfo.getPriceRatio();
				EbaimiProduct isAudit = new EbaimiProduct();
				isAudit.setIsAudit("0");
				List<EbaimiProduct> eList = eBaiMiDAO.queryAllJpayInfo(isAudit);
				if (eList != null && !eList.isEmpty()) {
					for (EbaimiProduct ebaiInfo : eList) {
						if (ebaiInfo != null) {
							goodsName = ebaiInfo.getName_goods();
							brandName = goodsName;
							String supplierId = eInfo.getSupplierId();
							String operator = eInfo.getOperator();
							String originalGoodsId = ebaiInfo
									.getOid_goodsitem();
							// 手拉手品牌处理
							String brandId = processSlsBrand(brandName,
									supplierId, originalGoodsId, operator);
							// 手拉手商品信息处理
							String goodsId = processSlsGoodsInfo(brandId,
									head2, supplierId, originalGoodsId,
									operator, goodsName, priceRatio);
							// 手拉手商品供应处理
							processSlsGoodsSupply(goodsId, supplierId,
									originalGoodsId, operator);
							EbaimiProduct eProduct = new EbaimiProduct();
							eProduct.setId(ebaiInfo.getId());
							eProduct.setIsAudit("1");
							eProduct.setModify_time(ServerDateAndTime
									.getNowDateTimeOfFormat());
							try {
								eBaiMiDAO.update(eProduct);
							} catch (Exception e) {
								log.error("易百米商品审核异常" + "--产品编号："
										+ originalGoodsId, e);
								continue;
							}
						}
					}
				}
			}
		}).start();
	}

	@Override
	public void saveAuditWogreatGoods(String body, Head head)
			throws ServerDisponseException {
		final WogreatProduct woInfo = gson.fromJson(body, WogreatProduct.class);
		final Head head2 = head;
		this.validateWoData(woInfo);
		new Thread(new Runnable() {
			@Override
			public void run() {
				// 产品品牌
				String brandName = null;
				// 商品名称
				String goodsName = null;
				// 价格利率
				int priceRatio = woInfo.getPriceRatio();
				WogreatProduct isAudit = new WogreatProduct();
				isAudit.setIsAudit("0");
				List<WogreatProduct> wList = wogreatDAO.queryAllWoInfo(isAudit);
				if (wList != null && !wList.isEmpty()) {
					for (WogreatProduct wp : wList) {
						if (wp != null) {
							goodsName = wp.getProductName();
							int index = goodsName.indexOf("-");
							int index2 = goodsName.indexOf("(");
							int index3 = goodsName.indexOf("（");
							String[] names = null;
							if (index > 0) {
								names = goodsName.split("-");
								brandName = names[0];
							} else if (index2 > 0) {
								names = goodsName.split("\\(");
								brandName = names[0];
							} else if (index3 > 0) {
								names = goodsName.split("（");
								brandName = names[0];
							} else {
								brandName = goodsName;
							}
							String supplierId = woInfo.getSupplierId();
							String operator = woInfo.getOperator();
							String originalGoodsId = wp.getProductId();
							if ("10046".equals(originalGoodsId)
									|| "10047".equals(originalGoodsId)
									|| "10172".equals(originalGoodsId)) {
								continue;
							}
							// 手拉手品牌处理
							String brandId = processSlsBrand(brandName,
									supplierId, originalGoodsId, operator);
							// 手拉手商品信息处理
							String goodsId = processSlsGoodsInfo(brandId,
									head2, supplierId, originalGoodsId,
									operator, goodsName, priceRatio);
							// 手拉手商品供应处理
							processSlsGoodsSupply(goodsId, supplierId,
									originalGoodsId, operator);
							WogreatProduct wProduct = new WogreatProduct();
							wProduct.setId(wp.getId());
							wProduct.setIsAudit("1");
							wProduct.setModifyTime(ServerDateAndTime
									.getNowDateTimeOfFormat());
							try {
								wogreatDAO.update(wProduct);
							} catch (Exception e) {
								log.error("沃谷商品审核异常" + "--产品编号："
										+ originalGoodsId, e);
								continue;
							}
						}
					}
				}
			}
		}).start();
	}

	@Override
	public void saveAuditYunGoods(String body, Head head)
			throws ServerDisponseException {
		final YunEnProduct yunProduct = gson.fromJson(body, YunEnProduct.class);
		final Head head2 = head;
		this.validateYunData(yunProduct);
		new Thread(new Runnable() {

			@Override
			public void run() {
				// 产品品牌
				String brandName = null;
				// 商品名称
				String goodsName = null;
				// 价格利率
				int priceRatio = yunProduct.getPriceRatio();
				YunEnProduct isAudit = new YunEnProduct();
				isAudit.setIsAudit("0");
				List<YunEnProduct> list = yunDAO.queryAllProduct(isAudit);
				if (list != null && !list.isEmpty()) {
					for (YunEnProduct yProduct : list) {
						goodsName = yProduct.getProductName();
						brandName = goodsName;
						String supplierId = yunProduct.getSupplierId();
						String operator = yunProduct.getOperator();
						String originalGoodsId = yProduct.getProductId();
						// 手拉手品牌处理
						String brandId = processSlsBrand(brandName, supplierId,
								originalGoodsId, operator);
						// 手拉手商品信息处理
						String goodsId = processSlsGoodsInfo(brandId, head2,
								supplierId, originalGoodsId, operator,
								goodsName, priceRatio);
						// 手拉手商品供应处理
						processSlsGoodsSupply(goodsId, supplierId,
								originalGoodsId, operator);
						YunEnProduct yPro = new YunEnProduct();
						yPro.setId(yProduct.getId());
						yPro.setIsAudit("1");
						yPro.setModifyTime(ServerDateAndTime
								.getNowDateTimeOfFormat());
						try {
							yunDAO.update(yPro);
						} catch (Exception e) {
							log.error("云恩商品审核异常" + "--产品编号：" + originalGoodsId,
									e);
							continue;
						}
					}
				}

			}

		}).start();

	}

	@Override
	public String saveAuditXQTGoods(String body, Head head)
			throws ServerDisponseException {
		final XingParvalueInfo parvalueInfo = gson.fromJson(body,
				XingParvalueInfo.class);
		validateXQTData(parvalueInfo);
		final Head head2 = head;
		new Thread(new Runnable() {
			@Override
			public void run() {
				int index = 0;
				// 产品品牌
				String brandName = null;
				// 商品名称
				String goodsName = null;
				// 价格利率
				int priceRatio = parvalueInfo.getPriceRatio();
				XingParvalueInfo isAudit = new XingParvalueInfo();
				isAudit.setIsAudit("0");
				List<XingParvalueInfo> xqtProductList = xingParvalueDAO
						.queryAllParvalueInfo(isAudit);
				log.info("星启天产品列表大小：" + xqtProductList.size());
				if (xqtProductList != null && !xqtProductList.isEmpty()) {
					log.info("准备进入for循环。。。");
					for (XingParvalueInfo xqtProduct : xqtProductList) {
						index++;
						if (xqtProduct != null) {
							brandName = xqtProduct.getGametype();
							String parvalueName = xqtProduct.getParvalueName();
							goodsName = brandName + parvalueName;
							String supplierId = parvalueInfo.getSupplierId();
							String operator = parvalueInfo.getOperator();
							String originalGoodsId = xqtProduct.getGoodsId();
							// 手拉手品牌处理
							String brandId = processSlsBrand(brandName,
									supplierId, originalGoodsId, operator);
							log.info("星启天产品审核，品牌编号：" + brandId);
							// 手拉手商品信息处理
							String goodsId = processSlsGoodsInfo(brandId,
									head2, supplierId, originalGoodsId,
									operator, goodsName, priceRatio);
							log.info("星启天产品审核，商品编号：" + goodsId);
							// 手拉手商品供应处理
							processSlsGoodsSupply(goodsId, supplierId,
									originalGoodsId, operator);
							log.info("星启天产品审核，供应处理。");

							XingParvalueInfo parvalue = new XingParvalueInfo();
							parvalue.setGoodsId(originalGoodsId);
							parvalue.setIsAudit("1");
							try {
								xingParvalueDAO.updateState(parvalue);
							} catch (Exception e) {
								log.error("更新星启天产品审核状态异常", e);
								continue;
							}
						}
					}
					log.info("for循环结束，执行的次数：" + index);
				}
			}
		}).start();
		return null;
	}

	private void validateYunData(YunEnProduct yunInfo) {
		this.validate(yunInfo);
		String supplierId = yunInfo.getSupplierId();
		String operator = yunInfo.getOperator();
		if (StringUtils.isEmpty(supplierId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else if (StringUtils.isEmpty(operator)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		}
	}

	private void validateWoData(WogreatProduct woInfo) {
		this.validate(woInfo);
		String supplierId = woInfo.getSupplierId();
		String operator = woInfo.getOperator();
		if (StringUtils.isEmpty(supplierId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else if (StringUtils.isEmpty(operator)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		}
	}

	private void validateEBaiMiData(EbaimiProduct eInfo) {
		this.validate(eInfo);
		String supplierId = eInfo.getSupplierId();
		String operator = eInfo.getOperator();
		if (StringUtils.isEmpty(supplierId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else if (StringUtils.isEmpty(operator)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		}
	}

	private void validateJpayData(JieyitongGoodsInfo jpayInfo) {
		this.validate(jpayInfo);
		String supplierId = jpayInfo.getSupplierId();
		String operator = jpayInfo.getOperator();
		if (StringUtils.isEmpty(supplierId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else if (StringUtils.isEmpty(operator)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		}
	}

	/**
	 * 校验星启天数据
	 * 
	 * @param xqtDisInfo
	 */
	private void validateXQTData(XingParvalueInfo parvalueInfo) {
		if (parvalueInfo == null) {
			throw new ServerDisponseException(
					ExceptionCodeDes.PARSE_REQUEST_ERROR.getCode(),
					ExceptionCodeDes.PARSE_REQUEST_ERROR.getDescription());
		}
		String supplierId = parvalueInfo.getSupplierId();
		String operator = parvalueInfo.getOperator();
		if (StringUtils.isEmpty(supplierId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else if (StringUtils.isEmpty(operator)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		}

	}

	/**
	 * 校验恩联数据
	 * 
	 * @param enlink
	 */
	private void validateEnLinkData(EnLinkProduct enlink) {
		if (enlink == null) {
			throw new ServerDisponseException(
					ExceptionCodeDes.PARSE_REQUEST_ERROR.getCode(),
					ExceptionCodeDes.PARSE_REQUEST_ERROR.getDescription());
		}
		String supplierId = enlink.getSuppliersId();
		String operator = enlink.getOperator();
		if (StringUtils.isEmpty(supplierId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else if (StringUtils.isEmpty(operator)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		}
	}

	/**
	 * 数据校验
	 * 
	 * @date 2012-12-01
	 */
	private boolean checkDataOfNutsNetGoods(NutsNetGoodsInfo nutsNetGoodsInfo,
			String reqId) throws ServerDisponseException {
		boolean flag = false;
		String supplierId = nutsNetGoodsInfo.getSuppliersId(); // 商品ID
		String operator = nutsNetGoodsInfo.getOperator();
		if (StringUtils.isEmpty(supplierId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else if (StringUtils.isEmpty(operator)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		} else {
			flag = true;
		}

		return flag;
	}

	/**
	 * 数据校验
	 */
	private boolean checkDataOfOhFeiGoods(OhFeiGoodsInfo ohFeiGoodsInfo,
			String reqId) throws ServerDisponseException {
		boolean flag = true;
		String operator = ohFeiGoodsInfo.getOperator();
		String supplierId = ohFeiGoodsInfo.getSuppliersId();
		if (StringUtils.isEmpty(operator)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		} else if (StringUtils.isEmpty(supplierId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else {
			flag = true;
		}

		return flag;
	}

	/**
	 * 数据校验
	 */
	private boolean checkDataOfTencentGoods(TencentGoodsInfo tencentGoodsInfo,
			String reqId) throws ServerDisponseException {
		boolean flag = false;
		String operator = tencentGoodsInfo.getOperator();
		String supplierId = tencentGoodsInfo.getSupplierId();
		if (StringUtils.isEmpty(operator)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		} else if (StringUtils.isEmpty(supplierId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else {
			flag = true;
		}

		return flag;
	}

	/**
	 * 坚果网络原始产品表，单条记录查询
	 * 
	 * @param body
	 * @param head
	 * @return
	 * @throws ServerDisponseException
	 */
	@Override
	public String queryOfNutsNetByGoodsId(String body, Head head)
			throws ServerDisponseException {
		if (log.isInfoEnabled()) {
			log.info("进入Service开始处理[" + head.getRequestId() + "]的请求");
		}

		// 对消息body进行解析
		NutsNetGoodsInfo nutsNetGoodsInfo = gson.fromJson(body,
				NutsNetGoodsInfo.class);
		// 商品编号
		String goodsId = nutsNetGoodsInfo.getSupProductId();
		boolean flag = checkDataOfId(goodsId, head.getRequestId());
		if (flag) { // 数据校验通过
			try {
				String resultBody = null;
				NutsNetGoodsInfo nutsNetGoodsInfo1 = null;
				nutsNetGoodsInfo1 = nutsNetGoodsInfoDAO.queryById(goodsId);
				if (nutsNetGoodsInfo1 != null) {
					resultBody = gson.toJson(nutsNetGoodsInfo1);
				}

				if (log.isInfoEnabled()) {
					log.info("Service处理[" + head.getRequestId() + "]的请求已结束");
				}
				return resultBody;
			} catch (Exception e) {
				log.error("Service处理[" + head.getRequestId() + "]的请求出现异常！");
				throw new ServerDisponseException(
						ExceptionCodeDes.GOODS_NAME_NULL.getCode(),
						ExceptionCodeDes.GOODS_NAME_NULL.getDescription());
			}
		}

		return null;
	}

	/**
	 * 殴飞原始产品表，单条记录查询
	 * 
	 * @param body
	 * @param head
	 * @return
	 * @throws ServerDisponseException
	 */
	@Override
	public String queryOfOhFeiByGoodsId(String body, Head head)
			throws ServerDisponseException {
		if (log.isInfoEnabled()) {
			log.info("进入Service开始处理[" + head.getRequestId() + "]的请求");
		}
		// 对消息body进行解析
		OhFeiGoodsInfo ohFeiGoodsInfo = gson.fromJson(body,
				OhFeiGoodsInfo.class);

		// 商品编号
		String goodsId = ohFeiGoodsInfo.getGoodsId();
		boolean flag = checkDataOfId(goodsId, head.getRequestId());
		if (flag) { // 数据校验通过
			try {
				String resultBody = null;
				OhFeiGoodsInfo ohFeiGoodsInfo1 = null;
				ohFeiGoodsInfo1 = ohFeiGoodsInfoDAO.queryById(goodsId);
				if (ohFeiGoodsInfo1 != null) {
					resultBody = gson.toJson(ohFeiGoodsInfo1);
				}

				if (log.isInfoEnabled()) {
					log.info("Service处理[" + head.getRequestId() + "]的请求已结束");
				}
				return resultBody;
			} catch (Exception e) {
				log.error("Service处理[" + head.getRequestId() + "]的请求出现异常！");
				throw new ServerDisponseException(
						ExceptionCodeDes.GOODS_NAME_NULL.getCode(),
						ExceptionCodeDes.GOODS_NAME_NULL.getDescription());
			}
		}

		return null;
	}

	/**
	 * 腾讯原始 产品表，单条记录查询
	 * 
	 * @param body
	 * @param head
	 * @return
	 * @throws ServerDisponseException
	 */
	@Override
	public String queryOfTencentByGoodsId(String body, Head head)
			throws ServerDisponseException {
		if (log.isInfoEnabled()) {
			log.info("进入Service开始处理[" + head.getRequestId() + "]的请求");
		}
		// 对消息body进行解析
		TencentGoodsInfo tencentGoodsInfo = gson.fromJson(body,
				TencentGoodsInfo.class);
		String goodsId = tencentGoodsInfo.getGoodsId();
		boolean flag = checkDataOfId(goodsId, head.getRequestId());
		if (flag) { // 数据校验通过
			try {
				String resultBody = null;
				TencentGoodsInfo tencentGoodsInfo1 = null;
				tencentGoodsInfo1 = tencentGoodsInfoDAO
						.queryGoodsInfoGoodsId(goodsId);
				if (tencentGoodsInfo1 != null) {
					resultBody = gson.toJson(tencentGoodsInfo1);
				}

				if (log.isInfoEnabled()) {
					log.info("Service处理[" + head.getRequestId() + "]的请求已结束");
				}
				return resultBody;
			} catch (Exception e) {
				log.error(e);
				log.error("Service处理[" + head.getRequestId() + "]的请求出现异常！");
				throw new ServerDisponseException(
						ExceptionCodeDes.GOODS_NAME_NULL.getCode(),
						ExceptionCodeDes.GOODS_NAME_NULL.getDescription());
			}
		}

		return null;
	}

	/**
	 * 数据校验
	 * 
	 * @param goodsId
	 * @param reqId
	 * @return
	 * @throws ServerDisponseException
	 */
	private boolean checkDataOfId(String goodsId, String reqId)
			throws ServerDisponseException {
		boolean flag = false;
		if ("".equals(goodsId) || goodsId == null) {
			throw new ServerDisponseException(
					ExceptionCodeDes.GOODS_ID_EMPTY.getCode(),
					ExceptionCodeDes.GOODS_ID_EMPTY.getDescription());
		} else {
			flag = true;
		}

		return flag;
	}

	@Override
	public void insertTencent(String body, Head head)
			throws ServerDisponseException {
		// 对消息body进行解析
		TencentGoodsInfo tencentGoodsInfo = gson.fromJson(body,
				TencentGoodsInfo.class);
		this.validate(tencentGoodsInfo);
		this.validateField(tencentGoodsInfo);
		String productName = tencentGoodsInfo.getProductName();
		TencentGoodsInfo tencent = this.tencentGoodsInfoDAO
				.queryGoodsByName(productName);
		if (tencent != null) {
			throw new ServerDisponseException(
					ExceptionCodeDes.GOODS_EXIST.getCode(),
					ExceptionCodeDes.GOODS_EXIST.getDescription());
		}
		try {
			tencentGoodsInfo.setId(UUID.randomUUID().toString());
			tencentGoodsInfo.setGoodsId(this.idGenerator());
			tencentGoodsInfo.setIsAudit("0");
			tencentGoodsInfo.setRechargeMode("2");
			this.tencentGoodsInfoDAO.insert(tencentGoodsInfo);
		} catch (Exception e) {
			log.error(e);
			throw new ServerDisponseException(
					ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
					ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
		}
	}

	/**
	 * 生成商品id
	 * 
	 * @return
	 */
	private String idGenerator() {
		String id = "";
		String maxCode = this.tencentGoodsInfoDAO.queryMaxGoodsId();

		if (StringUtils.isEmpty(maxCode)) {
			id = "100000000";
		} else {
			int code = Integer.parseInt(maxCode);
			id = String.valueOf(code + 1);
		}
		return id;
	}

	/**
	 * 校验是否为null
	 * 
	 * @param priceInfo
	 */
	private void validate(Object obj) throws ServerDisponseException {
		if (obj == null) {
			throw new ServerDisponseException(
					ExceptionCodeDes.PARSE_REQUEST_ERROR.getCode(),
					ExceptionCodeDes.PARSE_REQUEST_ERROR.getDescription());
		}
	}

	/**
	 * 校验属性是否为空
	 * 
	 * @param ruleInfo
	 * @throws ServerDisponseException
	 */
	private void validateField(TencentGoodsInfo tencentGoodsInfo)
			throws ServerDisponseException {
		if (StringUtils.isEmpty(tencentGoodsInfo.getProductName())) {
			throw new ServerDisponseException(
					ExceptionCodeDes.GOODS_NAME_NULL.getCode(),
					ExceptionCodeDes.GOODS_NAME_NULL.getDescription());
		}
		if (StringUtils.isEmpty(tencentGoodsInfo.getIn_acct_type())) {
			throw new ServerDisponseException(
					ExceptionCodeDes.USER_ACCOUNT_TYPE_EMPTY.getCode(),
					ExceptionCodeDes.USER_ACCOUNT_TYPE_EMPTY.getDescription());
		}
	}

	@Override
	public void updateTencent(String body, Head head)
			throws ServerDisponseException {
		TencentGoodsInfo tencent = gson.fromJson(body, TencentGoodsInfo.class);
		this.validate(tencent);
		String inPrice = tencent.getInPrice();
		if (StringUtils.isEmpty(inPrice)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.GOODS_SUPPLY_PRICE_NULL.getCode(),
					ExceptionCodeDes.GOODS_SUPPLY_PRICE_NULL.getDescription());
		}
		try {
			this.tencentGoodsInfoDAO.update(tencent);
		} catch (Exception e) {
			log.error("更新腾讯产品信息时出现异常！", e);
			throw new ServerDisponseException(
					ExceptionCodeDes.ACCESS_DATABASE_ERROR.getCode(),
					ExceptionCodeDes.ACCESS_DATABASE_ERROR.getDescription());
		}

	}

	/**
	 * 7996商品审核
	 * 
	 * @param body
	 * @param head
	 * @throws ServerDisponseException
	 * @author Wangxuegang
	 * @date 2013-04-26
	 */
	@Override
	public String saveSnnsGoods(String body, Head head)
			throws ServerDisponseException {
		if (log.isInfoEnabled()) {
			log.info("进入Service开始处理[" + head.getRequestId() + "]的请求");
		}
		// 对消息body进行解析
		final SevenNineNineSixProduct product = gson.fromJson(body,
				SevenNineNineSixProduct.class);
		final Head head2 = head;
		new Thread(new Runnable() {
			@Override
			public void run() {
				boolean flag = checkDateOfSnns(product, head2.getRequestId());
				if (flag) {
					try {
						// 产品品牌
						String brandName = null;
						// 商品名称
						String goodsName = null;
						// 价格利率
						int priceRatio = product.getPriceRatio();
						List<SevenNineNineSixProduct> snnsList = null;
						SevenNineNineSixProduct pr = new SevenNineNineSixProduct();
						pr.setIsAudit("0");
						snnsList = sevenNineNineSixDAO.queryAllProduct(pr);
						for (SevenNineNineSixProduct snnsPr : snnsList) {
							if (snnsPr != null) {
								// 商品名称
								// String name = snnsPr.getProductName();
								// ...==========?????????【需要解析7996商品名称】 待完善
							} else {
								log.error("Service处理[" + head2.getRequestId()
										+ "]的请求出现异常，商品记录数据库不存在！");
								throw new ServerDisponseException(
										ExceptionCodeDes.DATABASE_RECORDS_NOT_EXITS
												.getCode(),
										ExceptionCodeDes.DATABASE_RECORDS_NOT_EXITS
												.getDescription());
							}

							String supplyId = product.getSuppliersId();
							String operator = product.getOperator();
							String originalGoodsId = snnsPr.getProductId();
							// 手拉手品牌处理
							// 【brandName】的值有待于完善
							String brandId = processSlsBrand(brandName,
									supplyId, originalGoodsId, operator);
							// 手拉手商品信息处理
							String goodsId = processSlsGoodsInfo(brandId,
									head2, supplyId, originalGoodsId, operator,
									goodsName, priceRatio);
							// 手拉手商品供应处理
							processSlsGoodsSupply(goodsId, supplyId,
									originalGoodsId, operator);

							SevenNineNineSixProduct snnsProduct = new SevenNineNineSixProduct();
							snnsProduct.setProductId(originalGoodsId);
							snnsProduct.setIsAudit("1");
							sevenNineNineSixDAO.updateProduct(snnsProduct);
						}
					} catch (Exception e) {
						log.error(e);
						throw new ServerDisponseException(
								ExceptionCodeDes.ACCESS_DATABASE_ERROR
										.getCode(),
								ExceptionCodeDes.ACCESS_DATABASE_ERROR
										.getDescription());
					}
				}
			}
		}).start();

		return null;
	}

	/**
	 * 7996供应商数据校验
	 * 
	 * @param product
	 * @param reqId
	 * @return
	 * @throws ServerDisponseException
	 */
	private boolean checkDateOfSnns(SevenNineNineSixProduct product,
			String reqId) throws ServerDisponseException {
		boolean flag = false;
		String supplierId = product.getSuppliersId();
		String operator = product.getOperator();
		if (StringUtils.isEmpty(supplierId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else if (StringUtils.isEmpty(operator)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		} else {
			flag = true;
		}

		return flag;
	}

	/**
	 * 恩付产品审核
	 * 
	 * @param body
	 * @param head
	 * @throws ServerDisponseException
	 * @author Wangxuegang
	 * @date 2013-05-07
	 */
	@Override
	public void saveAuditEnfuGoods(String body, Head head)
			throws ServerDisponseException {
		if (log.isInfoEnabled()) {
			log.info("进入Service开始处理[" + head.getRequestId() + "]的请求");
		}
		// 对消息body进行解析
		final EnfuGoodsInfo goodsInfo = gson
				.fromJson(body, EnfuGoodsInfo.class);
		final Head head2 = head;
		new Thread(new Runnable() {

			@Override
			public void run() {
				boolean flag = checkDateOfEnfu(goodsInfo, head2.getRequestId());
				if (flag) {
					try {
						// 产品品牌
						String brandName = null;
						// 商品名称
						String goodsName = null;
						// 价格利率
						int priceRatio = 0;
						// goodsInfo.getPriceRatio();
						EnfuGoodsInfo enfuGoodsInfo = new EnfuGoodsInfo();
						enfuGoodsInfo.setIsAudit("0");
						List<EnfuGoodsInfo> enList = null;
						enList = enfuGoodsDAO.queryAllGoodsInfo(enfuGoodsInfo);
						for (EnfuGoodsInfo enGoInfo : enList) {
							if (enGoInfo != null) {
								// 商品名称
								String name = "";
								// enGoInfo.getName();
								String[] str = new String[3];
								if (name != null) {
									str = name.split("-");
								}

								brandName = str[1];
								goodsName = str[1] + str[2];
							}

							String supplyId = "";
							// goodsInfo.getSuppliersId();
							String operator = goodsInfo.getOperator();
							String originalGoodsId = "";
							// goodsInfo
							// .getSupProductId();

							// 手拉手品牌处理
							String brandId = processSlsBrand(brandName,
									supplyId, originalGoodsId, operator);
							// 手拉手商品信息处理
							String goodsId = processSlsGoodsInfo(brandId,
									head2, supplyId, originalGoodsId, operator,
									goodsName, priceRatio);
							// 手拉手商品供应处理
							processSlsGoodsSupply(goodsId, supplyId,
									originalGoodsId, operator);

							EnfuGoodsInfo enInfo = new EnfuGoodsInfo();
							// enInfo.setSupProductId(originalGoodsId);
							enInfo.setIsAudit("1");
							enfuGoodsDAO.updateState(enInfo);

						}
					} catch (Exception e) {
						log.error(e);
						throw new ServerDisponseException(
								ExceptionCodeDes.ACCESS_DATABASE_ERROR
										.getCode(),
								ExceptionCodeDes.ACCESS_DATABASE_ERROR
										.getDescription());
					}

				}

			}

		}).start();

	}

	/**
	 * 
	 * @param goodsInfo
	 * @param reqId
	 * @return
	 */
	private boolean checkDateOfEnfu(EnfuGoodsInfo goodsInfo, String reqId) {
		boolean flag = false;
		String supplierId = null;
		// goodsInfo.getSuppliersId();
		String operator = goodsInfo.getOperator();
		if (StringUtils.isEmpty(supplierId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else if (StringUtils.isEmpty(operator)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		} else {
			flag = true;
		}

		return flag;
	}

	@Override
	public void saveGoodsSupplyInfo(String body, Head head)
			throws ServerDisponseException {
		GoodsManageInfo goodsInfo = gson.fromJson(body, GoodsManageInfo.class);
		this.validate(goodsInfo);
		String supplyId = goodsInfo.getSupplyId();
		String goodsId = goodsInfo.getGoodsId();
		String originalGoodsId = goodsInfo.getOriginalGoodsId();
		String operator = goodsInfo.getOperator();
		if (StringUtils.isBlank(goodsId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.GOODS_ID_EMPTY.getCode(),
					ExceptionCodeDes.GOODS_ID_EMPTY.getDescription());
		} else if (StringUtils.isBlank(supplyId)) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		}
		this.processSlsGoodsSupply(goodsId, supplyId, originalGoodsId, operator);
	}
	
	public void saveAuditMaxshuGoods(String body, Head head){
		
		final MaxshuProduct woInfo = gson.fromJson(body, MaxshuProduct.class);
		final Head head2 = head;
		this.validate(woInfo);
		if (StringUtils.isEmpty(woInfo.getSupplierId())) {
			throw new ServerDisponseException(
					ExceptionCodeDes.SUPPLY_ID_NULL.getCode(),
					ExceptionCodeDes.SUPPLY_ID_NULL.getDescription());
		} else if (StringUtils.isEmpty(woInfo.getOperator())) {
			throw new ServerDisponseException(
					ExceptionCodeDes.OPERATOR_NO_NULL.getCode(),
					ExceptionCodeDes.OPERATOR_NO_NULL.getDescription());
		}
		new Thread(new Runnable() {
			@Override
			public void run() {
				// 产品品牌
				String brandName = null;
				// 商品名称
				String goodsName = null;
				// 价格利率
				int priceRatio = woInfo.getPriceRatio();
				MaxshuProduct isAudit = new MaxshuProduct();
				isAudit.setIsAudit("0");
				List<MaxshuProduct> wList = maxshuDAO.queryAllWoInfo(isAudit);
				if (wList != null && !wList.isEmpty()) {
					for (MaxshuProduct wp : wList) {
						if (wp != null) {
							goodsName = wp.getProductName();
							int index = goodsName.indexOf("-");
							int index2 = goodsName.indexOf("(");
							int index3 = goodsName.indexOf("（");
							String[] names = null;
							if (index > 0) {
								names = goodsName.split("-");
								brandName = names[0];
							} else if (index2 > 0) {
								names = goodsName.split("\\(");
								brandName = names[0];
							} else if (index3 > 0) {
								names = goodsName.split("（");
								brandName = names[0];
							} else {
								brandName = goodsName;
							}
							String supplierId = woInfo.getSupplierId();
							String operator = woInfo.getOperator();
							String originalGoodsId = wp.getProductId();
							if ("10046".equals(originalGoodsId)
									|| "10047".equals(originalGoodsId)
									|| "10172".equals(originalGoodsId)) {
								continue;
							}
							// 手拉手品牌处理
							String brandId = processSlsBrand(brandName,
									supplierId, originalGoodsId, operator);
							// 手拉手商品信息处理
							String goodsId = processSlsGoodsInfo(brandId,
									head2, supplierId, originalGoodsId,
									operator, goodsName, priceRatio);
							// 手拉手商品供应处理
							processSlsGoodsSupply(goodsId, supplierId,
									originalGoodsId, operator);
							MaxshuProduct wProduct = new MaxshuProduct();
							wProduct.setId(wp.getId());
							wProduct.setIsAudit("1");
							wProduct.setModifyTime(ServerDateAndTime
									.getNowDateTimeOfFormat());
							try {
								maxshuDAO.update(wProduct);
							} catch (Exception e) {
								log.error("数网商品审核异常" + "--产品编号："
										+ originalGoodsId, e);
								continue;
							}
						}
					}
				}
			}
		}).start();
	}
}
